jQuery.get()

sysntax:-

jQuery.get( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] )

 

$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});

 

$.get( "ajax/test.html", function( data ) {
$( ".result" ).html( data );
alert( "Load was performed." );
});

 

$.get( "test.php", { name: "John", time: "2pm" } );

 

$.get( "test.php", { "choices[]": ["Jon", "Susan"] } );

 

$.get( "test.php", function( data ) {
alert( "Data Loaded: " + data );
});

 

$.get( "test.cgi", { name: "John", time: "2pm" } )
.done(function( data ) {
alert( "Data Loaded: " + data );
});

 

$.get( "test.php", function( data ) {
$( "body" )
.append( "Name: " + data.name ) // John
.append( "Time: " + data.time ); // 2pm
}, "json" );
url
Type: String
A string containing the URL to which the request is sent.
data
Type: PlainObject or String
A plain object or string that is sent to the server with the request.
success(data, textStatus, jqXHR)
Type: Function()
A callback function that is executed if the request succeeds.
dataType
Type: String
The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
Author: bm on October 7, 2013
Category: ajax