[eluser]jvk22[/eluser]
I'm trying to create a jQuery update function. I have it so when you click on a link, a light box opens and you are able to edit the content. However once you try to submit the form via AJAX I get this error.
"Maximum function nesting level of '100' reached"
I can't figure out why it's running an infinite loop.
This is the page that opens inside the light box.
Code:
[removed]
$(document).ready(function(){
$("#edit_header").submit(function(){
var description = $("#description").val();
$.ajax({
type: "POST",
url: "<?php echo site_url('builder/update_header'); ?>",
data: { description: description,
},
//data: "name="+status+"_"+record,
success: function(html) {
if(html == 1)
{
$("#header_data").html(description);
$(".success").html('The header has been updated successfully.');
}
else if (html == 0)
{
$(".error").show();
$(".success").hide();
}
}
});
return false;
});
});
[removed]
<?php
$header_attr = array(
'name' =>'description',
'id' =>'description',
'value' =>$header_content,
);
?>
<h2>Header</h2>
<div class="success"></div>
<?php echo form_open('','id="edit_header"'); ?>
<?php echo form_textarea($header_attr); ?><br />
<?php echo form_submit('submit','Update Header'); ?>
<?php echo form_close(); ?>
And this is the update function
Code:
public function update_header()
{
$data = array(
'content'=>$this->input->post('description'),
);
$this->x_builder->update_header($this->user_id, $data);
echo 1;
}