<?php echo $this->Form->create('Property',array('id'=>'add_property'));?>
<?$data = $this->Js->get('#add_property')->serializeForm(
array(
'isForm' => true,
'inline' => true)
);?>
<? echo $this->Js->submit('submit.png',
array('id'=>'submit_id',
'update' => '#right_side_content', // element to update
'data'=>$data,
'before' => $this->Js->get('#submit_busy-indicator')->effect('fadeIn', array('buffer' => false)),
'complete' => $this->Js->get('#submit_busy-indicator')->effect('fadeOut', array('buffer' => false)),
));?>
Generates the following code:
$(document).ready(function () {$("#submit_id").bind("click", function (event) {$.ajax({beforeSend:function (XMLHttpRequest) {$("#submit_busy-indicator").fadeIn();}, complete:function (XMLHttpRequest, textStatus) {$("#submit_busy-indicator").fadeOut();},
data:$("#submit_id").closest("form").serialize(), dataType:"html", success:function (data, textStatus) {$("#right_side_content").html(data);}, type:"POST", url:"\/cakeapp\/property\/add_property"});
return false;});});
Shouldn't this line:
data:$("#submit_id").closest("form").serialize(), dataType:"html"
be
data:$("#add_porperty").closest("form").serialize(), dataType:"html"
?