jQuery encapsulated ajax
$.get(url [,data] [,fn callback function] [, dataType]);
data: The data passed to the server, request string and json object can be set
fn: callback function, this function is called after the ajax request is completed, you can use this function Complete the subsequent processing of ajax
dataType: The server returns the data type, html, text, xml, json
Note: The ajax It is an asynchronous get request
##$.post(url[,data][,fn callback function][, dataType]);
- This method is exactly the same as the $.get() method. The difference is that it is a post request.
$.ajax({ //json object
php.cn ajax请求
- php content is:
$name, 'age'=>$age ); echo json_encode($arr); ?>