JQuery Ajax passes special character parameters (e.g. +)

Source: Internet
Author: User

When using jquery ajax to pass parameter para=1+1 to the background, the background receives a parameter of Para=1 1, and the solution is to use JSON to pass the code as follows.

varurl = "/test/check"; $.ajax ({type:"POST", Url:url,//data: "Para=1+1", data is a string when the background received the parameter is 1 1Data: {"Para":}, //Data is JSON when the background receives the parameter is  the cache:false, Async:false, DataType:"JSON", Success:function(data, Textstatus, JQXHR) {if("true" = =Data.flag) {Alert (Legitimate "); return true; }Else{alert ("Not legal!" The error message is as follows: "+data.errormsg); return false; }}, Error:function(XMLHttpRequest, Textstatus, Errorthrown) {alert ("The request failed!" "); }     });

JQuery Ajax passes special character parameters (e.g. +)

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.