php - jQuery.ajax response data giving null -


i trying insert data mysql database using jquery , ajax. have written query parameters in add.php file. show form data immediatly beneath form.

jquery:

jquery("#addstockinform").submit(function(e){   e.preventdefault();   datastring = jquery("#addstockinform").serialize();   jquery.ajax({     type: "post",     url: "add.php",     data: datastring,      datatype: "json",     success: function(data) {         //$("div#showinstant").html(data);         alert(data);     }   }); }); 

add.php file

require 'foo.config.php'; if(isset($_post['addstockin'])) {   $query = "insert stockin ( serialno, project_id, ...... etc. ) values (`:serialno, :project_id, ....... etc. )"; 

add-stockin.php file

<form class="form-horizontal" id="addstockinform" method="post"> ..... </form> 

you should return data php code frontend

require 'foo.config.php'; if(isset($_post['addstockin'])) {    $query = "insert stockin ( serialno, project_id, ...... etc. ) values                                  (`:serialno, :project_id, ....... etc. )"; ... ... echo yourdata 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -