Jquery get method

Load data from the server using a HTTP GET render result back to page. Jquery get method supports many type of data like php, html, json and text.

Syntax Structure:

$.get( url, [data], [callback], [type] )

Jquery get() Method Parameters

Url: Required. A string containing the url you wish to request

Data: its optional, specified data (key/value) will send to server

Function (Callback): this optional parameter and this function to be executed when the data is loaded successfully.

Type: this optional parameter. That specifies the data type expected of the server response. Possible types: "xml", "html", "script", "json", "jsonp", or "text".


Here we have simple jquery Get Method code

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">

<div id="get_request"></div>
<button id="load_data">Load data for getrequest Div</button> $(document).ready(function(){ $("#load_data").click(function(){ $.get("ajaxexample.xml",function(ajaxresult){ $("#get_request").html(ajaxresult); }); }); }); </script>