Copy codeThe Code is as follows:
$. Ajax ({
Type: "POST ",
Url: "some. php ",
Data: "name = John & location = Boston", // The first method for passing Parameters
// Data: {name: "John", location: "Boston"} // The second method for passing Parameters
// Data: {foo: ["bar1", "bar2"]} to '& foo = bar1 & foo = bar2'
/*
First, we use the url to pass parameters. If the parameter contains the "&" symbol, the parameters may not be received or are incomplete,
For example, "data:" name = John & location = Boston "," If the value of name is "john & smith", there may be problems in writing,
We can use the encodeURIComponent () method in JS to escape,
However, if data: {name: "John", location: "Boston"} is used for writing, you do not need to escape it,
If it is escaped, it will receive the escaped string.
*/
Success: function (msg ){
Alert ("Data Saved:" + msg );
}
});