PHP / AJAX will only submit results of form once. First click works, second is blank
I'm getting some very odd behavior and I can't figure it out开发者_如何转开发.
I've modified a piece of code from Bright Cherry [http://bit.ly/fmhcbu] and I'm basically just trying to change the value of a mySQL row from 0 to 1 or vice versa and refresh the results onscreen.
VIEW PAGE HERE
When you click the submit button, the record is updated in the database and the page auto refreshes correctly. But, when you click a second button, nothing happens.
Has anyone run in to this issue before? Thanks in advance!
you need to re-run the jQuery ajaxForm code after each reload.
update the code:
<script type="text/javascript">
function makeAjaxForm(){
$('#myForm').ajaxForm({
target: '#showdata',
success: function() {
$('#showdata').fadeIn('slow');
makeAjaxForm();
}
});
}
$(document).ready(function() {
makeAjaxForm();
});
</script>
精彩评论