jquery.js以及jquery.json.js下载地址http://pan.baidu.com/s/1eQszeVo
1.首先复制一份 transport.js 改名为 transport.org.js 提供给后台使用
2.屏蔽掉transport.js里的toJSON功能 行数大概有497-737行之间
将352行
legalParams = "JSON=" + params.toJSONString();
改为
legalParams = "JSON=" + $.toJSON(params);
将408行
result = result.parseJSON();
改为
result = $.evalJSON(result);
3.屏蔽掉global.js里的如下代码(第10-13行):
Object.prototype.extend = function(object)
{
return Object.extend.apply(this, [this, object]);
}
16行function $()改名为function $e()
114行和126行
var element = $(element);
修改为
var element = $e(element);
4.index.js文件44行
var res = result.parseJSON();
改为:
var res = $.evalJSON(result);
5.common.js中function addToCart()里的
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');
修改为
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), addToCartResponse, 'POST', 'JSON');
将function addPackageToCart()里的
Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' + package_info.toJSONString(), addPackageToCartResponse, 'POST', 'JSON');
修改为
Ajax.call('flow.php?step=add_package_to_cart', 'package_info=' + $.toJSON(package_info), addPackageToCartResponse, 'POST', 'JSON');
将function submit_div()里的
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');
修改为
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), addToCartResponse, 'POST', 'JSON');
6.compare.js,
49行
this.data = cookieValue.parseJSON();
修改为
this.data = $.evalJSON(cookieValue);
67行
var obj = cookieValue.parseJSON();
修改为
var obj = $.evalJSON(cookieValue);
133行
document.setCookie("compareItems", this.data.toJSONString());
修改为
document.setCookie("compareItems", $.toJSON(this.data));
7.admin\templates\pageheader.htm
9行
{insert_scripts files="../js/transport.js,common.js"}
修改为
{insert_scripts files="../js/transport.org.js,common.js"}
8.admin\templates\menu.htm
151行
{insert_scripts files="../js/global.js,../js/utils.js,../js/transport.js"}
修改为
{insert_scripts files="../js/global.js,../js/utils.js,../js/transport.org.js"}
9.themes\default\library\page_header.lbi,在
{insert_scripts files='transport.js,utils.js'}
上,添加
{insert_scripts files='jquery.js,jquery.json.js'}
10.themes\default\library\comment_list.lbi,
188行
Ajax.call('comment.php', 'cmt=' + cmt.toJSONString(), commentResponse, 'POST', 'JSON');
修改为
Ajax.call('comment.php', 'cmt=' + $.toJSON(cmt), commentResponse, 'POST', 'JSON');
11.themes\default\compare.dwt
20行
var obj = document.getCookie("compareItems").parseJSON();
修改为
var obj = $.evalJSON(document.getCookie(compareItems));
24行
document.setCookie("compareItems", obj.toJSONString());
修改为
document.setCookie("compareItems", $.toJSON(obj));
12.themes\default\flow.dwt
138行
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), collect_to_flow_response, 'POST', 'JSON');
修改为
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), collect_to_flow_response, 'POST', 'JSON');
199行
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), fittings_to_flow_response, 'POST', 'JSON');
修改为
Ajax.call('flow.php?step=add_to_cart', 'goods=' + $.toJSON(goods), fittings_to_flow_response, 'POST', 'JSON');
13.以下文件中的
brand.dwt
brand_list.dwt
category.dwt
exchange_list.dwt
search.dwt
{insert_scripts files='common.js,global.js,compare.js'}
之上,添加
{insert_scripts files=jquery.js,jquery.json.js}
如:
{* 包含脚本文件 *}
{insert_scripts files=jquery.js,jquery.json.js}
{insert_scripts files=common.js,global.js,compare.js}
转载自:
http://www.ecmoban.com/article-1629.html