How can I override Drupal.ajax written in misc/ajax.js?
I need to check URL existence before firing an AJAX call.
Is there any other way/better way to achieve that without overriding this js?
Thanks
How can I override Drupal.ajax written in misc/ajax.js?
I need to check URL existence before firing an AJAX call.
Is there any other way/better way to achieve that without overriding this js?
Thanks
I don't know about Drupal.ajax but this Jquery Method is the way to go:
$(document).ajaxSend(function(event, jqxhr, settings){
if ( settings.url == "some urls" ) {//checks if related url should be checked or not.
//Do Something like
This url checkingor what ever you want.
if(!UrlExists(settings.url)){
jqxhr.abort();
}
}
});
Be careful, This method is a global ajax event -- so this effectively can filter all ajax requests.