jquery.axios(jquery.axios)

概念:通过 HTTP 请求加载远程数据。

*注:所有的选项都可以通过$.ajaxSetup()函数来全局设置。

回调函数:要处理$.ajax()得到的数据,则需要使用回调函数。beforeSend、error、dataFilter、success、complete。

beforeSend 在发送请求之前调用,并且传入一个XMLHttpRequest作为参数。

error 在请求出错时调用。传入XMLHttpRequest对象,描述错误类型的字符串以及一个异常对象(如果有的话)

dataFilter 在请求成功之后调用。传入返回的数据以及”dataType”参数的值。并且必须返回新的数据(可能是处理过的)传递给success回调函数。

success 当请求之后调用。传入返回后的数据,以及包含成功代码的字符串。

complete 当请求完成之后调用这个函数,无论成功或失败。传入XMLHttpRequest对象,以及一个包含成功或错误代码的字符串。

1.需要引入js

————————

Concept: load remote data via HTTP request.

*Note: all options can be set globally through the $. Ajaxsetup() function.

Callback function: to process the data from $. Ajax (), you need to use the callback function. beforeSend、error、dataFilter、success、complete。

BeforeSend calls before sending a request, and passes a XMLHttpRequest as a parameter.

Error called when a request has an error. Pass in the XMLHttpRequest object, a string describing the error type, and an exception object (if any)

DataFilter is called after the request is successful. The data passed in and returned and the value of the “datatype” parameter. And must return new data (possibly processed) to the success callback function.

Success is called after request. Pass in the returned data and the string containing the success code.

Complete calls this function when the request is completed, regardless of success or failure. Pass in the XMLHttpRequest object and a string containing the success or error code.

1. JS needs to be introduced