Ie under $.getjson problem solution
- 2020-03-30 01:43:00
- OfStack
Premise: import related js file jquery.js
Seven-letter $.post (url, data, data, textStatus, jqXHR), dataType)
Url: required. Specify the URL to which the request is sent.
Data: optional. Map or string values. Specifies the data to be sent to the server along with the request.
Success (data, textStatus, jqXHR) : optional. The callback function that executes when the request succeeds.
DataType: performs intelligent judgment (XML, json, script, or HTML) by default.
Seven-letter $. GetJSON (url, data, data, textStatus, XHR))
Url: required. Specify which URL the request will be sent to.
Data: optional. Specifies the data to be sent to the server along with the request.
Success (data, the status, XHR) :
Optional. Specifies the function to run when the request succeeds.
Additional parameters:
Response - contains the resulting data from the request
Status - contains the status of the request
XHR - contains the XMLHttpRequest object
The extension is written as:
There are several types of dataType: XML, json, script, or HTML
Note:
When using the $.getjson method, if there are Chinese characters in the url to be escaped first (if not escaped, ie8 under $_GET['v'] will not get the value, other browsers do not have this problem)
Eg:
Var url = ". / API PHP? Op =product&v="+encodeURIComponent(' study hard ');
Seven-letter $.post (url, data, data, textStatus, jqXHR), dataType)
Url: required. Specify the URL to which the request is sent.
Data: optional. Map or string values. Specifies the data to be sent to the server along with the request.
Success (data, textStatus, jqXHR) : optional. The callback function that executes when the request succeeds.
DataType: performs intelligent judgment (XML, json, script, or HTML) by default.
Seven-letter $. GetJSON (url, data, data, textStatus, XHR))
Url: required. Specify which URL the request will be sent to.
Data: optional. Specifies the data to be sent to the server along with the request.
Success (data, the status, XHR) :
Optional. Specifies the function to run when the request succeeds.
Additional parameters:
Response - contains the resulting data from the request
Status - contains the status of the request
XHR - contains the XMLHttpRequest object
The extension is written as:
$.ajax({
type:'POST' or 'GET',
url:url,
data:data,
success:callback,
dataType:json
});
There are several types of dataType: XML, json, script, or HTML
Note:
When using the $.getjson method, if there are Chinese characters in the url to be escaped first (if not escaped, ie8 under $_GET['v'] will not get the value, other browsers do not have this problem)
Eg:
Var url = ". / API PHP? Op =product&v="+encodeURIComponent(' study hard ');