The ContentType setting type causes AJAX post data to get nothing

Source: Internet
Author: User

Ajax post data is not available, note the settings of Content-type, Post/get
About JQuery data. Online all kinds of access to data, garbled and so on.
Well, I also met today, on the Internet to find a variety of entanglements. Garbled no matter what the first look to get data.
Because the parameters have been passed in jquery Ajax get before, the value of ContentType is not set by default.

Summary: Get mode This is what we call the Get method, the parameters are followed by the URL, not related to Content-type.

1 varSkip = 49;//Number of skipped row2       vartake = 14;//3       functionLoad (Skip, take) {4$ (' #divPostsLoader '). html ('  ');5           //send a query to server side to present new content6 $.ajax ({7Type: "Get",8URL: "Ajaximage.ashx",9 data: {skip:skip, take:take},Ten                //contentType: "Application/json; Charset=utf-8 ",//(CAN) One               //contentType: "Text/xml",//(CAN) A                //contentType: "application/x-www-form-urlencoded",//(CAN) -               //dataType: "string", -Successfunction(data) { the                    if(Data! = "") { -$ ('. Thumb ')). append (data); -                    } -$ (' #divPostsLoader '). empty (); +                } -            }) +};

Summary: Post mode

1 varSkip = 49;//Number of skipped row2       vartake = 14;//3       functionLoad (Skip, take) {4$ (' #divPostsLoader '). html ('  ');5           //send a query to server side to present new content6 $.ajax ({7Type: "Get",8URL: "Ajaximage.ashx",9 data: {skip:skip, take:take},Ten                //contentType: "Application/json; Charset=utf-8 ",//(not allowed) One                //contentType: "Text/xml",//(not allowed) AContentType: "Application/x-www-form-urlencoded",//(yes) -               //dataType: "string", -Successfunction(data) { the                    if(Data! = "") { -$ ('. Thumb ')). append (data); -                    } -$ (' #divPostsLoader '). empty (); +                } -            }) +};


You can also refer to http://www.aikaiyuan.com/6324.html

The ContentType setting type causes AJAX post data to get nothing

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.