<script type="text/javascript">
$(function(){
$("a[rel='tab']").click(function(e){
e.preventDefault();
pageurl = $(this).attr('href');
$.ajax({url:pageurl+'?rel=tab',success: function(data){
$('#right_column').html(data);
}});
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
return false;
});
});
</script>
The previous code is what I am using to update a div element with content when a link is clicked with rel="tab"
inside the <a>
tag.
Example <a>
Tag:
<a href="index.php?v1=variable1&v2=variable2" rel="tab">Click Here</a>
So now, I need to update the following lines of the javascript code above to substring out index.php out of the link...
$.ajax({url:pageurl+'?rel=tab',success: function(data){
$('#right_column').html(data);
}});
But need to keep the full url for the last section of the javascript as pageurl.
How would I do something like this?
I did research on this and tried implementing the answer listed here: How to substring in jquery but couldn't seem to get it to work.