Home >Web Front-end >JS Tutorial >jQuery ajax routing and filter usage instructions_jquery

jQuery ajax routing and filter usage instructions_jquery

WBOY
WBOYOriginal
2016-05-16 18:04:001371browse

Unfortunately, one legacy system I worked with didn't do this. So I used jQuery's ajaxPrefilter on the client to modify the calling method.

Copy code The code is as follows:



ajaxPrefilter demo







Use comparison
Copy code The code is as follows:

// After transformation
$.post('/ajax/dir/page/action',{page:1})
// Before transformation
$.post('/ajax.php',{
dir : 'dir',
page : 'page',
action : 'action',
args : JSON.stringify( { page:1 })
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn