Home  >  Article  >  Backend Development  >  ecshop jquery conflict resolution method ecshop introduction ecshop assistant ecshop theory

ecshop jquery conflict resolution method ecshop introduction ecshop assistant ecshop theory

WBOY
WBOYOriginal
2016-07-29 08:52:191204browse

1. Add the following code at the end of the transport.js file

/* *

* Correct json.prototype information

*/

function obj2str(o){

// Compatible with jquery

// Delete first ecshop's conflict object with jquery

//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)

i]))

r="{"+r.join()+"}"

}else{

for(var i =0;i

r.push(obj2str (o[i]))

                                                                                                                                                                             

}

2. Add