AJAX = Asynchronous JavaScript and XML (Asynchronous JavaScript and XML).
js in Ajax:
Parameter Description:
open (String method, String url, boolean asynch);
preparation request:
URL:
GET / POST
to true / false:
to true: Asynchronous
false: Synchronous
readyState
change the state of the XMLHttpRequest object. 4 (complete) data has been received, this time for obtaining a complete response information responseXML or responseText.
Status
the HTTP server status code (200 = OK 404 = Not Found
responseText
server's response, expressed as a text.
responseXML
response from the server, represented as an XML document.
= function ajax.onreadystatechange () {
// callback
IF (ajax.status == == 200 is && ajax.readyState. 4) {
// Get the server feedback
// Get Data
var = ajax.responseText Data
var = ajax.responseXML dataxml
// do dom operation using js
}
}
JQuery in Ajax:
-
$.ajax({
-
of the type: "POST", // submission
-
url : "${pageContext.request.contextPath}/org/doDelete.action",//路径
-
data : {
-
"org.id" : "${org.id}"
-
} // data used here is the transmission format Json
-
success : function(result) { //返回数据根据结果进行相应的处理
-
if ( result.success ) {
-
$( "#tipMsg").text("删除数据成功");
-
tree.deleteItem( "${org.id}", true);
-
} else {
-
$( "#tipMsg").text("删除数据失败");
-
}
-
}
-
});