The data returned by the AJAX request does not see the callback function is not executed or the error is not

Source: Internet
Author: User

Ajax request returned data do not see the callback function is not executed, where there is no error, there are similar cases of friends can refer to the following article

The project is SSH, using jquery's $.post to access Struts2 's action, where there is no error, but no results.

Now $.post to return the collection collection with the permission, the permission class privilege is associated with the user class user, which means that privilege uses the set collection to hold the user set with this permission , and user users also use the The set collection holds the permissions set for the user . The data went to the action, but the callback function was not executed, and the data returned was not seen using browser debugging, and it was finally found for a long time, for the following reasons:

When jquery parses the returned collection collection, it sees that there is a set in it, it goes to the data in the collection, but the collection is returned by a method in the service, and this time the SPR ING's transaction is over, and the data in the set is not found. jquery resolves an empty collection and then fails, so no data is available.

Workaround: The GetUser () method in privilege adds this annotation @json (serialize=false) so that jquery ignores the data in the collection when parsing it. Of course, if the data is to be used, it is necessary to check the data in the service and put it in the collection.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

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.