내 링크는 https://mytestsite.com/search/label/interesting?m=1
href 링크에서 특정 문자를 제거하려면 어떻게해야합니까?
어떻게 링크 끝에서 제거 할 수 있습니까?
내 링크는 https://mytestsite.com/search/label/interesting?m=1
href 링크에서 특정 문자를 제거하려면 어떻게해야합니까?
어떻게 링크 끝에서 제거 할 수 있습니까?
var str = "https://mytestsite.com/search/label/interesting?m=1";
str = str.slice(0, -4);
URL을 ?
자로 간단히 나눌 수 있습니다. 당신은 단지 소스에서 제거 할 수 있습니다 https://mytestsite.com/search/label/interesting
당신은 단순히이
var address = "https://mytestsite.com/search/label/interesting?m=1";
var pieces = address.split('?')[0];
// to show address after being sliced
alert(pieces);
요청되지 않은 jQuery 요청을 추가하는 이유는 무엇입니까? – jwpfox
내 대답 편집 –
처럼 할 수 -
arr[0]
에서당신은 결과를 얻을 것인가? –
m이있는 경우 리디렉션을 수행하십시오. – madalinivascu
URL을'?'문자로 분리 할 수 있습니다. 지금까지 뭐 해봤 어? – lharby