Home > Web Front-end > JS Tutorial > body text

Solution to the problem of $.getJSON under IE_javascript skills

WBOY
Release: 2016-05-16 17:00:16
Original
1243 people have browsed it

Prerequisite: The relevant js file jquery.js needs to be imported

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

url: required. Specifies the URL to which the request should be sent.

data: optional. Map or string value. Specifies the data to be sent to the server with the request.

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

dataType: Perform intelligent judgment by default (xml, json, script or html).

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

url: required. Specifies the URL to which the request will be sent.

data: optional. Specifies the data to be sent to the server with the request.

success(data,status,xhr):

Optional. Specifies a function to run when the request succeeds.

Extra parameters:

response - contains the result data from the request
status - contains the status of the request
xhr - contains the XMLHttpRequest object

extension is written as :

Copy code 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:

uses the $.getJson method When, if there are Chinese characters passed into the URL, they need to be escaped first (if not escaped, $_GET['v'] will not get the value under IE8, other browsers do not have this problem)

eg:

var url = "/api.php?op=product&v=" encodeURIComponent('Study hard');
Related labels:
ie
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!