当我这样做window.loaction我得到剥出管理员出来的url
pathname: "/shopper/admin/index.php"
我真的需要
pathname: "/shopper/index.php"
监守当我这样做jQuery的负载,我需要管理员出来的网址
$('.replace').load('index.php?route=module/cart/ajax_sub?category_id=12');
当我这样做window.loaction我得到剥出管理员出来的url
pathname: "/shopper/admin/index.php"
我真的需要
pathname: "/shopper/index.php"
监守当我这样做jQuery的负载,我需要管理员出来的网址
$('.replace').load('index.php?route=module/cart/ajax_sub?category_id=12');
var my_location = window.location.pathname.replace('admin/', '');
编辑
你可以用简单的做替换:
pathname = "/shopper/admin/index.php"
pathname = pathname.replace('/admin', ''); // replace with nothing
// would be: "/shopper/index.php"
可以使用替换功能删除路径的部分:
var part = '/admin';
window.location.replace(part, '');
你不能只使用绝对网址吗? '$(”取代。 ')负载('/购物者/ index.php的路线=模块/购物车/ ajax_sub CATEGORY_ID = 12' ?);' – 2011-04-19 21:24:21