function callSendAjax(){
$("addProductsForm").submit(function(){
$.post("return.php", $(this).serialize(), function(data){
//$('#saveResult').html(data);
alert(data);
});
return false;
});
}
I practically got this code from a book which submits a form through ajax and gets the response back. But nothing happens when i click e save button. No errors no returns.
Heres the simplified HTML:
<form action="" method="post" enctype="multipart/form-data" name="addProductsForm">
<table>
//some form input elements
<input type="button" value="Save" onclick="callSendAjax()" />
<div id="saveResult"></div>
</table>
</form>
Finally heres the return.php:
<?php
print_r($_POST);
?>
I’m supposed to get a return of all values returned displayed through $_POST, but nothing happens.