Ecshop jquery Conflict Resolution method

Source: Internet
Author: User

1. Add the following code at the end of the  transport.js file/* * *  fix json.prototype information  */function obj2str (o) {   //  compatible  jquery    //  Remove  ecshop    jquery  conflicting objects First         //delete Object.prototype.toJSONString;      var r = [];    if (typeof o == "string")  return   "\" "+o.replace (/([\ \ \ \ \])/g," \\$1 "). Replace (/(\ n)/g," \\n "). Replace (/(\ r)/g," \\r "). Replace (/(\ t)/g," \\t " ) + "\" ";     if (typeof o ==" undefined ")  return " undefined ";     if (typeof o ==  "Object") {        if (o=== NULL)  return  "null";         else if (!o.sort) {             for (Var i in o)        &nbSp;         r.push ("\" "+i+" \ "" + ":" +obj2str (O[i]))              r= "{" +r.join () + "}"          }else{            for (var i  =0;i<o.length;i++)                  r.push (Obj2str (o[i))              r= "[" +r.join () + "]"         }         return r;    }    return o.tostring ();}    2. Add <script>  //  compatible  jquery    //at the bottom of conflicting pages   then delete  ecshop    jquery  conflicting objects     delete  Object.prototype.tojsonstring;</script>   &nbsp3. Find Ajax.call in conflicting pages (' Flow.php?step=add_to_cart ',  ' goods= '  + goods.tojsonstring (),  collect_to_flow_response,  ' POST ',  ' JSON ');  replaced by: Ajax.call (' Flow.php?step=add_to_cart ',  ' Goods= '  + obj2str (goods), collect_to_flow_response,  ' POST ',  ' JSON ');

Ecshop jquery Conflict Resolution method

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.