This is a simple POST Request function to replace complex $. ajax: You can call the callback function when the request is successful. If you are interested, refer to the following. I hope jQuery is a popular js library, it can use simple code to make the desired results, as the official website says "write less, do more ". To a certain extent, Jquery has rewritten the previous JavaScript writing method. I used jquery to implement the asynchronous communication effect using ajax in the previous article, and feel the charm of jquery.
First, you need to download jquery's latest js file and introduce it into the file. You can also download it here: Click here to download it.
This communication uses jquery's jQuery. post (url,[Data],[Callback],[Type]) Method, which is a simple POST Request function to replace complex $. ajax. You can call the callback function when the request is successful. Parameters: url, [data], [callback], and [type] correspond to the following parameter types: String, Map, Function, String:
●Url: Send request address.
●Data: Key/value parameter to be sent.
●Callback: Callback function when sending successfully.
●Type: Returned content format, xml, html, script, json, text, _ default)
Create a jqueryDemo. jsp file. The Code is as follows:
The Code is as follows:
<% @ Page language = "java" contentType = "text/html; charset = GB18030"
PageEncoding = "GB18030" %>
Jquery