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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -