Jquery.form Ajax No Refresh upload Error resolution method

Source: Internet
Author: User

Today, when using Ajaxfileupload, Firebug reported a "jquery.handleerror is not a function" error. Since the previous use of Jquery.form has not been the problem, I compared to the previous project to find that the use of jquery in this project is a 1.10.2 version, and used to use the 1.4.2. After a few Niang, to find a solution: Jquery.handleerror is not a function error causes are:

Handlererror only existed in the previous version of jquery-1.4.2, and the function was not available in the jquery-1.4.2 version.

So adding this function to the jquery advanced version solves the problem. The JS code snippet can be added to the Jquer.js or ajaxfileupload.js.

;  
                    (function ($) {Jquery.extend ({handleerror:function (S, xhr, status, E) {  
                    if (s.error) {s.error.call (S.context | | s, XHR, status, E); } if (S.global) {(s.context? JQuery (S.context): jquery.event). Trigger ("  
                    Ajaxerror ", [XHR, S, E]); }, Httpdata:function (XHR, type, s) {var ct = xhr.getrespons Eheader ("Content-type"), XML = Type = = "xml" | | !type && Ct && ct.indexof ("xml") >= 0, data = XML?  
                    Xhr.responseXML:xhr.responseText;  
                    if (xml && data.documentElement.tagName = = "ParserError") throw "ParserError";  
                    if (s && s.datafilter) data = s.datafilter (data, type); if (typeof datA = = = "string" {if (type = = "Script") jquery.globaleval (data);  
                    if (type = = "json") data = window["eval"] ("(+ Data +)");  
                } return data; }  
            });

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/ajax/

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.