[英]stripping out the admin out of the url
when i do window.loaction i get 当我做window.loaction我得到
pathname: "/shopper/admin/index.php"
i really need 我真的需要
pathname: "/shopper/index.php"
becuase when i do the jquery load i need the admin out of the url 因为当我执行jquery加载时,我需要url之外的管理员
$('.replace').load('index.php?route=module/cart/ajax_sub?category_id=12');
var my_location = window.location.pathname.replace('admin/', '');
编辑
you can do with simple replace: 您可以使用简单的替换操作:
pathname = "/shopper/admin/index.php"
pathname = pathname.replace('/admin', ''); // replace with nothing
// would be: "/shopper/index.php"
You can remove the section of the path by using the replace function: 您可以使用replace函数删除路径的一部分:
var part = '/admin';
window.location.replace(part, '');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.