How to Solve the Problem $. getJSON in ie _ javascript tips-js tutorial

Source: Internet
Author: User
In ie, $. getJSON is a common problem. The following describes how to solve the problem. If you need it, refer to the following prerequisites: You need to import the relevant js file jquery. js.

$. Post (url, data, success (data, textStatus, jqXHR), dataType)

Url: required. Specifies the URL to which the request is sent.

Data: Optional. Ing or string value. Specifies the data sent to the server together with the request.

Success (data, textStatus, jqXHR): Optional. The callback function executed when the request is successful.

DataType: Smart judgment (xml, json, script, or html) is performed by default ).

$. GetJSON (url, data, success (data, textStatus, xhr ))

Url: required. Specifies the URL of the request.

Data: Optional. Specifies the data sent to the server together with the request.

Success (data, status, xhr ):

Optional. Specifies the function that runs when the request is successful.

Additional parameters:

Response-contains the result data from the request
Status-contains the Request status
Xhr-contains XMLHttpRequest object

Extended write:

The Code is as follows:


$. Ajax ({

Type: 'post' or 'get ',

Url: url,

Data: data,

Success: callback,

DataType: json

});


DataType has these types: xml, json, script, or html

Note:

Use $. when using the getJson method, if a Chinese character is input into the url, it must be escaped first (without escaping, $ _ GET ['V'] Under ie8 will not GET the value, and other browsers will not have this problem)

Eg:

Var url = "/api. php? Op = product & v = "+ encodeURIComponent ('good learn ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.