I am using the below code for getting the current URL in jQuery.
var pathname = window.location.pathname;
console.log(pathname);
Now I have got the url like this
http://localhost/TantraProjects/CollectiveCraft/Repo/WebSite/index.php/crafts/t-lights.html
I want to convert the URL into this
http://localhost/TantraProjects/CollectiveCraft/Repo/WebSite/index.php
Is there any a way to convert into URL as above, whatever the URL is ?
Assuming you will always get index.php in your url and you want to remove everything after index.php, following code will work:
var url='http://localhost/TantraProjects/CollectiveCraft/Repo/WebSite/index.php/crafts/t-lights.html';
var b= url.split('index.php');
var newurl=b[0]+'index.php';
document.write(newurl);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다