Czy istnieje sposób, aby usunąć wszystko po określonej postaci lub po prostu wybrać wszystko do tej postaci? Dostaję wartość od href aż do „?” I zawsze będzie to inna liczba znaków.
Lubię to
/Controller/Action?id=11112&value=4444
Chcę, aby href był /Controller/Actiontylko, więc chcę usunąć wszystko po „?”.
Używam tego teraz:
$('.Delete').click(function (e) {
e.preventDefault();
var id = $(this).parents('tr:first').attr('id');
var url = $(this).attr('href');
console.log(url);
}