stripping out the admin out of the url
when i do window.loaction i get
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
$('.replace').load('index.php?route=module/cart/ajax_sub?ca开发者_如何学Ctegory_id=12');
var my_location = window.location.pathname.replace('admin/', '');
EDIT
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:
var part = '/admin';
window.location.replace(part, '');
try the following to strip the "/admin" from the URL
pathname: "/shopper/admin/index.php".replace("\/admin","")
Demo here
精彩评论