object.prototype.tojsonstring = function () {**************}
大概 580行到590行之间 这个句用于格式化json,他重写了object的结构,导致于js框架冲突,如果要解决需要把这段代码注释掉,然后用别的方式替换。
我是将所有用到*.tojsonstring的地方,替换成一个函数,例如:
/js/common.js 29行
ajax.call(‘flow.php?step=add_to_cart', ‘goods=' + goods.tojsonstring, addtocartresponse, ‘post', ‘json');
替换成:
ajax.call(‘flow.php?step=add_to_cart', ‘goods=' + obj2str(goods), addtocartresponse, ‘post', ‘json');
obj2str函数如下:
function obj2str(o){var r = [];if(typeof o ==”string”) return “”+o.replace(/([\'\\\])/g,”\$1″).replace(/(\n)/g,”\”).replace(/(\r)/g,”\ ”).replace(/(\t)/g,”\ ”)+””;if(typeof o ==”undefined”) return “undefined”;if(typeof o == “object”){if(o===null) return “null”;else if(!o.sort){for(var i in o)r.push(“”+i+””+”:”+obj2str(o[i]))r=”{“+r.join()+”}”}else{for(var i =0;i
我注释了下面这一段
/*object.prototype.tojsonstring = function () {……// join all of the fragments together and return.a.push(‘}');return a.join(”);};*/