简体   繁体   English

在Ajax成功之前将页面加载到div中

[英]Load page into div before ajax success

I have a website on which I load subpages into container div through jquery.load(). 我有一个网站,通过jquery.load()将子页面加载到容器div中。

On one subpage after user fill in form and submits it. 用户填写表单并提交后,在一个子页面上。 I use ajax to process this form. 我使用ajax处理这种形式。 It is a long process (php search big database) and until I get success I cannot move to another supage because when i click other navigation button it stills on load() functions and waits until this ajax is finished. 这是一个漫长的过程(用php搜索大数据库),直到我获得成功之前,我无法转移到另一个地方,因为当我单击其他导航按钮时,它仍然处于load()函数上,并等待该ajax完成。 I dont want to freeze navigation because of this ajax did not finished. 我不想冻结导航,因为此ajax尚未完成。 So load() cannot be executed until ajax finish? 因此,直到ajax完成,才能执行load()? How to do that? 怎么做?

I would change my .load()'s into jQuery.get()'s . 我会将.load()更改为jQuery.get() Then, I'd cancel my ajax call when the user clicks another nav button. 然后,当用户单击另一个导航按钮时,我将取消ajax调用。 Abort Ajax requests using jQuery . 使用jQuery中止Ajax请求 jQuery.get() returns a XHR (or equivelant) object just like $.ajax does. jQuery.get()返回一个XHR(或等效对象)对象,就像$ .ajax一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM