Thursday, May 14, 2015

Ajax Jquery Tutorial Example

Jquery Ajax  Tutorial
For the  jquery ajax you  need to add the jquery library  first

<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>


After that   you can write  the code for  ajax  by which you can get the  data from other file on server without refreshing
<script>
$.ajax({
  method: "POST",   //  ajax posting method
  url: " ‘your file path’ /ajax.php",   // File path and name on your server 
  data: { name: "vikas gautam ", location: "Mohali" }  // variable to pass to the  file ajax.php

})
  .done(function( msg ) {
    alert( "Data Saved: " + msg );  // alert back response data  for the
  $(“# result”).html(msg);   // to pass the result to you htm div
  variable
  });

</script>

<div id=”result”></div>  /here the result will show









No comments:

Post a Comment