为$不用彷徨的jQuery异步的? [英] Is $.get of jquery asynchronous?
问题描述
我不知道我是否应该用在我的网站或没有异步调用。我知道明确指定这一点,我需要用
$。阿贾克斯
不过最初我试图用 $。获得
,虽然服务器不得不返回大量的信息,我的浏览器没有被卡住,我可以浏览没有任何问题。
我搜索一点点网上关于它,但是我还没有100%确定对两者之间的区别。
如果 $。获得
是异步的那么什么是 $点。AJAX
?如果不是,那么再见到我怎么没有导航的问题与 $。获得
,有什么用 $。阿贾克斯$ C点$ C>?
在此先感谢
是的, $。获得
是异步的。从文档:
这是一个简写的Ajax功能,相当于:
$。阿贾克斯({ 网址:网址, 数据:数据, 成功:成功, 的dataType:数据类型 });
...并作为不具有异步
选项,异步
默认为真
。 (请注意,异步
将完全消失jQuery中的未来版本。它的总是是真实的)
如果
点$。获得
是异步那有什么的$。阿贾克斯
?
$。阿贾克斯
,您可以控制更多的选择。 $。获得
仅仅是一个捷径。
I was wondering whether I should use asynchronous calls on my website or not. I know to specify this explicitly I need to use
$.ajax
however initially I tried using $.get
and although the server had to return lots of information, my browser didn't stuck and I could navigate without any problems.
I searched a little bit online about it, however I'm still not 100% certain about the difference between the two.
If $.get
is asynchronous then what's the point of $.ajax
? And if it's not, then again seeing how I had no navigation problems with $.get
, what's the point of using $.ajax
?
thanks in advance
Yes, $.get
is asynchronous. From the documentation:
This is a shorthand Ajax function, which is equivalent to:
$.ajax({ url: url, data: data, success: success, dataType: dataType });
...and as that doesn't have the async
option, async
defaults to true
. (Note that async
will be going away entirely in a future version of jQuery; it will always be true.)
If
$.get
is asynchronous then what's the point of$.ajax
?
$.ajax
gives you control over lot more options. $.get
is just a shortcut.
这篇关于为$不用彷徨的jQuery异步的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!