javascript - Intercepting AJAX Calls -


i'm facing problem intercepting ajax calls. know how can somehow intercept ajax calls @ level ajaxsetup(). have 1 question: ajaxsetup() intercepts calls within document. don't want that. i'm trying changing default type 'get' 'post' of calls. , need use ajaxsetup(). there way how can 'setup' selected or 'ajax calls follow url pattern'? thank you.

use beforesend in $.ajaxsetup()

$.ajaxsetup({     beforesend: function (jqxhr, settings) {         settings.type = settings.url.indexof("foo") > -1 ? "post" : "get"     } }); 

get request changed post -> fiddle
(check network panel changed submission method)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -