$.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston", //The first way to pass parameters
// data: {name:"John",location:"Boston" } //The second way to pass parameters
// data: {foo:["bar1", "bar2"]} is converted to '&foo=bar1&foo=bar2'
/*
The first way we Use url to pass parameters. If the "&" symbol is added to the parameter, the parameter may not be received or may be incomplete.
For example, "data: "name=John&location=Boston"," if the value of name is "john&smith" There may be problems when writing this way.
We can use the encodeURIComponent() method in JS to escape.
But if we write it in this way: {name: "John", location: "Boston"} If
is escaped, the received string will be the escaped string
*/
success: function(msg){
alert( "Data Saved: " msg );
}
});