jQuery Ajax load Method


jQuery Ajax load method loads data from server and returns data in the specified element.


jQuery Ajax load Method Syntax

$(selector).load(url,data,function(response,status,xhr));

url(Required): Url of the file you want to load.
data(optional): Data returned from server

function : (optional): Callback is executed when the request completes.

jQuery Ajax load Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#ajaxExample" ).on( "click", function(event) {             
                          var uri = 'http://runtest.tutorialsplane.com/';
                          $("#myDiv").load(uri+"test.html",function(response,status,xhr){
                              alert("Status = "+xhr.statusText+" Response = "+xhr.responseText);
                          });     
              });               
          });
</script>

Try it »


User Ans/Comments

📖 Read More


    Advertisements