Jquery ajax, jquery
1. You can set global attributes, which will be simple to call later.
JQuery. ajaxSetup () code:
$.ajaxSetup({ url: "/xmlhttp/", global: false, type: "POST"});$.ajax({ data: myData });
Set global AJAX default options
Ii. jquery ajax full Parsing
Jquery ajax full parsing-parameter description
Jquery ajax full parsing-$. post ()
Jquery ajax full parsing-jQuery. getScript (url, [callback]): load and execute a JavaScript file using GET requests.
Jquery ajax full parsing-serialize () and serializeArray ()
Jquery ajax usage
JQUERY:
$. Ajax ({
Type: 'post', // optional get
Url: 'action. php', // The php program that receives data.
Data: 'Data = 'dsa ', // data transmitted to PHP. Use & to connect multiple parameters.
DataType: 'text', // the data type returned by the server can be XML or Json jsonp script html text.
Success: function (msg ){
// Here is the data processing function returned by the PHP program after ajax is submitted successfully. Msg is the returned data. The data type is defined in the dataType parameter!
},
Error: function (){
Processing Function for ajax submission failure!
}
})
PHP action. php
<? Php
Echo "this is a ajax example! ";
?>
Jquery ajax usage
JQUERY:
$. Ajax ({
Type: 'post', // optional get
Url: 'action. php', // The php program that receives data.
Data: 'Data = 'dsa ', // data transmitted to PHP. Use & to connect multiple parameters.
DataType: 'text', // the data type returned by the server can be XML or Json jsonp script html text.
Success: function (msg ){
// Here is the data processing function returned by the PHP program after ajax is submitted successfully. Msg is the returned data. The data type is defined in the dataType parameter!
},
Error: function (){
Processing Function for ajax submission failure!
}
})
PHP action. php
<? Php
Echo "this is a ajax example! ";
?>