Consider this code that runs when the page is loaded:
if ($('#content-recommendation').length) {
$.ajax({
url:'/get_content_recommendation/' + gon.item_id + '.js',
type:"get"
});
}
And this request take about 15 seconds to complete in development. If I go to another page I have to wait until the Ajax is completed so, how do I cancel that Ajax request?