I am trying to rebind a click event to post a form and ajax the html
$('.btnSave').addClass('yui3-button').click(function() {
var $this = $(this);
var id = $(this).parent().attr('id');
$.post(
"MTrades/save",
$.param({ mycase: 1 }) + '&' + $(this).parent().parent().serialize(),
function(data) {
alert("page - " + data);
$this.parent().fadeOut("fast").load(
"MTrades/index/"+id+"/options",
function() {
//rebind the click event
BindClick();
}).fadeIn("fast");
});
return false;
});
The form parameters send works for the first time but not the second time
(after I have saved and reloaded the html)
the .serialize() returns empty.
html (shorten):
<form id="Form2">
<button>
<div>
<button>save
<form>
<table>
</table>
</form>
</div>
</form>
thanks
I have replaced the outer form with
<div>and I send the inner
<form>with$(this).parent().find('form').serialize()instead of
$(this).parent().parent().serialize()