3.1 The support for Ajax is more perfect, as shown in:
Judging Ajax ways to improve
You can now use the constant Is_ajax directly to determine whether the Ajax way request is used to replace the Isajax method of the previous http://www.aliyun.com/zixun/aggregation/16339.html ">action class", The advantage is that you can judge in any code. The error and success method of the action class is built to support automatic judgment support for Ajax.
Perfection of Ajaxreturn method
The original Ajaxreturn method can only return the fixed structure of data, including information, status and info index, if you need to extend additional return data information, only through the Ajaxassign method, 3.1 version of the Ajaxreturn method itself, Enables better support for AJAX data extensions, such as:
$data [' status '] = 1; $data [' info '] = ' return information '; $data [' data '] = ' return data '; $data [' url '] = ' URL address '; $this->ajaxreturn ($data);
An array of data values can be defined arbitrarily. The improved Ajaxreturn method is also compatible with previous wording, such as:
$this->ajaxreturn ($data, ' info ', 1);
The system automatically incorporates info and 12 parameters into the $data array, equivalent to the assignment
$data [' info '] = ' info '; $data [' status '] = 1; $data [' data '] = $data; $this->ajaxreturn ($data);
This use is no longer recommended.
Success and Error methods perfect for AJAX support
In the case of Ajax, the success and error methods of the action class are improved, and the parameters of the two methods are converted to the info, status, and URL parameters of the data for the Ajaxreturn method. You can also support passing in other parameters, and there are two ways to support Ajax transfer values. Take the success method as an example, the first way is to directly pass in AJAX data
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.