Javascript 异步ajax调用阻塞UI

Javascript 异步ajax调用阻塞UI,javascript,ajax,asynchronous,Javascript,Ajax,Asynchronous,呈现JSP之后,我将尝试通过ajax进行异步调用,以便在页面上加载其他信息 我希望ajax加载能够顺利进行,而不会妨碍UI滚动条导航。但是调用会阻塞UI,直到onLoad完成 在其他时候,此服务甚至在鼠标单击ajax调用时也会阻塞UI(在加载数据之前,光标保持为pointertype) 在这两种情况下,我都是通过javascript构建DOM(比如为div或表创建innerHTMl)。是因为这个吗?还是别的什么?我正在附上我的ajax请求代码 谢谢你的帮助。(抱歉,我试图格式化代码,但无法在此处

呈现JSP之后,我将尝试通过ajax进行异步调用,以便在页面上加载其他信息

我希望ajax加载能够顺利进行,而不会妨碍UI滚动条导航。但是调用会阻塞UI,直到onLoad完成

在其他时候,此服务甚至在鼠标单击ajax调用时也会阻塞UI(在加载数据之前,光标保持为
pointer
type)

在这两种情况下,我都是通过javascript构建DOM(比如为div或表创建innerHTMl)。是因为这个吗?还是别的什么?我正在附上我的ajax请求代码

谢谢你的帮助。(抱歉,我试图格式化代码,但无法在此处获取)

更新: 对此服务的onLoad调用

function loadAdInfo(){
   var theParamObj = {"REQUEST_URI" : window.location.href};
   requestService('getAdInfo', theParamObj, false);
}

XMLHTTPObject open方法的定义如下:

open(method,url,async)  Specifies the type of request, the URL, and if the request should be handled asynchronously or not.

method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)

你通过考试是错误的。因此,您将其称为getAjaxRequest()的同步代码。为什么不使用jquery?删除对
HandlerResponse
的调用,看看会发生什么。@giammin,项目可能需要更多的时间才能开始使用jquery…现在可能不会了。@Jon,我可以试试,但我就是在这里处理DOM构建的。是否应该做些工作?@Harsh:我知道这就是你构建DOM的地方。我的观点是,如果您的DOM构建花费了很长时间,那么很明显,在您完成之前,页面将变得没有响应,这不是AJAX部分的错。
open(method,url,async)  Specifies the type of request, the URL, and if the request should be handled asynchronously or not.

method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)