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

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -