When i click a link i need to send post via ajax. The problem is that the request is dropped because of open a link.
jQuery('#pagination a').click(function(){
jQuery.post('index.php?option=com_component',
{checked_sites_for_session: jQuery('.selected-site input[type="checkbox"]').map(function () {return this.value;}).get()}
).success(function(){window.location = jQuery(this).attr('href')});
console.log(jQuery(this).attr('href'));
return false;
});
But again the problems is (thanks to joomla) in url – its like /~user/joomla/index.php/view-sites?view=sites&page=2 – as you see it starts from slash, but the real link is http://localhost/~user/joomla/index.php/view-sites?view=sites&page=2, but in the source i have <a href="index.php?option=com_component&view=sites&.’.$option.’page=’.$left.'”//….`
So i need some “multipurpose domain parsing solution” or just stop joomla changing my url’s.
Using the native element.href will get you the entire href including the domain, and not just the attributes value, also there’s a scope issue with the
thiskeyword being used inside the $,post function :From the links you’ve posted they don’t look to be the same at all, so you might have to figure something out for that, as some CMS solutions use rewriting etc.