问题描述
同时通过AJAX在jQuery的学习,我就翻过2项,即, $。阿贾克斯prefilter()和 $。ajaxSetup()。所有我能找到的是,这些加载或拨打电话到前在阿贾克斯一些修改的的 $。阿贾克斯()的。有人可以简化并伴随着两个轻微的对比解释eaziest形式的这些条款?
while learning through ajax in jQuery, I came accross 2 terms, viz., $.ajaxPrefilter() and $.ajaxSetup(). All I can find out is that these make some changes in ajax before loading or making call to $.ajax(). Can someone simplify and explain these terms in eaziest form along with a slight comparison of the two?
<一个href="http://api.jquery.com/jquery.ajax$p$pfilter/">http://api.jquery.com/jquery.ajax$p$pfilter/
http://api.jquery.com/jQuery.ajaxSetup/
我特别不理解这些的 4 VOTEDOWNS 。我想100人投了下来,但后ATLEAST提供有效的答复或回答我的问题。关于这个问题的一些事实:
I specifically dont understand these 4 VOTEDOWNS. I would like 100 people to vote down, BUT after atleast providing valid responses or answering my question. Some facts about this question:
1)我没有发现问过类似的问题。
2)我真的不明白背后的这2点的概念。
3)我公司提供适当的解释相关的链接,显示我做了ATLEAST一些研究。
4)毫无疑问是一个坏的问题或愚蠢的问题。
5)你自己不明白的概念,如果你不能解释一个6岁的孩子。
6)如果这5个有效分后,您不提供任何答案,刚刚的的投票下来的坐在后面的AC房间,猎自己作为队长的魅力,我想你是这些样的人,谁需要了解他们无非是巴基青衫老鸭子!
6) If after these 5 valid points you ARE NOT PROVIDING ANY ANSWERS, just voting it down sitting back in AC Rooms, and hunting yourself as Captain Charisma, I think you are those kind of people, who need to understand they are nothing more than Bucky Old Pathetic Ducks!
再见...
推荐答案
$ ajaxSetup()
- 为未来的Ajax请求设置默认值。你可以,例如,设置您的的AJAX网址总是的想使用这里的每一个请求。
$.ajaxSetup()
- Set default values for future Ajax requests. You could, for example, set the ajax URL that you always want to use for every request here.
例如:
$.ajaxSetup({
// Always use this URL for every request
url: "http://example.com/ajax.php"
});
$阿贾克斯prefilter()
- 修改现有方案的每个请求被发送之前。可以,例如,附加一个查询字符串分量到发送每Ajax请求
$.ajaxPrefilter()
- Modify existing options before each request is sent. You could, for example, append a query string component to every ajax request that is sent out.
例如:
$.ajaxPrefilter( function(options) {
// Always add "?debug=1" to every URL
options.url += (options.url.indexOf("?") < 0 ? : "?" : "&") + "debug=1";
});
这篇关于$就prefilter()VS $ .ajaxSetup() - jQuery的阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!