problem : Through jquery encapsulation Ajax request for File upload operation, the back end has returned upload file success, the front-end reference also no problem, the browser does not have any error, but always enter the error callback, the first big.
cause of the cause:
1.a link problem
If a link has href,href= "" will refresh the page, before refreshing the page will enter the action, so will invoke Ajax to get the submission of data, but before returning, the page will be refreshed operation, as long as the change to href= "#", add a click event on OK.
2.dataType
If you specify datatype as JSON when you perform AJAX, first check the jquery version, only a version less than 1.3 can perform the success callback, and the following version is very demanding in JSON format
"JSON": evaluates the response as JSON and returns a JavaScript object. In JQuery 1.4 The JSON data are parsed in a strict manner; Any Malformedjson are rejected and a parse error is thrown. (Information on proper JSON formatting.)
The JSON format should meet the following requirements :
Key Name: Double quote
Strings: Double Quotes
Numbers, Boolean types: no double quotes required
So far, only two of them have been encountered, there should be other reasons, welcome to append