php - javascript issue -


how can add variables code above? need pass these 2 variables. tried code doesn't work expect (alerts doesn't working alterations).

        name: $('#name').val(),         email: $('#email').val()   <script type="text/javascript">     jquery(document).ready(function() {         $.ajax("valid.php", {             type: "post",             datatype: "json",             name: $('#name').val(), //here??             email: $('#email').val() //here??             success: function(step) {                  if (step.first) {                     alert("fdsgdfg");                 }                 if (step.second) {                     alert("dfgdfg");                 }              }         });     }); </script> 

thanks!

add part ajax call called "data".

<script type="text/javascript"> jquery(document).ready(function() {     $.ajax("valid.php", {         type: "post",         datatype: "json",         data: { name: $('#name').val(), email: $('#email').val() },         success: function(step) {              if (step.first) {                 alert("fdsgdfg");             }             if (step.second) {                 alert("dfgdfg");             }          }     }); }); 

alternatively:

$.ajax({     type: "post",     url: "some.php",     data: "name=john&location=boston",     success: function(msg){         alert( "data saved: " + msg );     } }); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -