Home > Article > Web Front-end > How jquery implements ajax technology 1: $.ajax()
ajax technology is very important in web development. In early js, if you need to complete the effect of asynchronous transmission, you need to judge the browser, virtually access files, monitor, obtain return values, and a series of very tedious operations. But jQuery provides us with several very simple functions that allow us to easily implement ajax functions. In the next few articles, we will introduce these functions one by one.
First, let’s introduce $.ajax. This method is the underlying AJAX implementation of jQuery.
The usual syntax is:
$.ajax([settings])//settings is the parameter of the $.ajax() method and is a collection of key-value pairs used to configure Ajax requests.
Let’s introduce some of the more important parameters in $.ajax() one by one
url---the address to send the request
type---request method ("POST" or "GET")
timeout---setting Request timeout (milliseconds)
async---(Default: true) Asynchronous request.
Data---The parameters sent can be of json type
dataType---Returned data type: xml, html, json, txt
Success---After success, function(data,st){} can be returned
Actual examples are as follows :
================================================ ================
ajax.html
============================================ ====================== ajax.php echo 'The website you want to visit is'.$_POST['web ']; ?> The above is the content of how jquery implements ajax technology 1: $.ajax(). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!