jQuery Ajax get Method


jQuery Ajax get method loads data from server using the HTTP GET Request.


jQuery Ajax $.get() Method Syntax

$.get(url,function(response,status));

url(Required): Url of the file you want to load.
function : (optional): Callback is executed when the request completes.

jQuery Ajax get method Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#ajaxExample" ).on( "click", function(event) {             
                          var uri = 'http://runtest.tutorialsplane.com/php/';
                          $.get(uri+"get_method_demo.php",function(response,status){
                              alert("Status = "+status+" Response = "+response);
                          });     
              });               
          });
</script>

Try it »

Note : get_method_demo.php contains the following data which is returned from the server :

<h3>Get Method Demo</h3>

Data Loaded from server using get method.

Advertisements

Add Comment

📖 Read More