jQuery.get()
Loads data from the server using a HTTP GET request.
Examples:
Example: Request the test.php page, but ignore the return results.
1 
 | 
  | 
Example: Request the test.php page and send some additional data along (while still ignoring the return results).
1 
 | 
  | 
Example: Pass arrays of data to the server (while still ignoring the return results).
1 
 | 
  | 
Example: Alert the results from requesting test.php (HTML or XML, depending on what was returned).
1 
2 
3 
 | 
  | 
Example: Alert the results from requesting test.cgi with an additional payload of data (HTML or XML, depending on what was returned).
1 
2 
3 
4 
 | 
  | 
Example: Get the test.php page contents, which has been returned in json format (<?php echo json_encode(array("name"=>"John","time"=>"2pm")); ?>), and add it to the page.
1 
2 
3 
4 
5 
 | 
  | 
Note : 
As of jQuery 1.5, the 
success callback function is also passed a "jqXHR" object (in jQuery 1.4, it was passed theXMLHttpRequest object). However, since JSONP and cross-domain GET requests do not use XHR, in those cases thejqXHR and textStatus parameters passed to the success callback are undefined.
No comments:
Post a Comment