2013年4月16日 星期二

jQuery GET Requests

$.get(url, data, callback, dataType) can retrieve data from a server:

image

$ is a jQuery object and .get() is a global function

dataType can be one of:

HTML, XML, JSON, string, or script

image

 

$.getJSON(url, data, callback) can retrieve JSON data from a server

image

 

Demo Example:

image

CustomerJson.aspx.cs

image

$.get(url, data, callback, dataType)

image

$.getJSON(url, data, callback)

image

 

Additional Notes:

1. http://james.padolsey.com/jquery

image

2. .load() is always HTML datatype

3. .load() without data –> it’s a GET request

4. .load() with data –> become POST request

image

沒有留言:

張貼留言