为什么沙漏工作不与谷歌浏览器同步AJAX请求

为什么沙漏工作不与谷歌浏览器同步AJAX请求

本文介绍了为什么沙漏工作不与谷歌浏览器同步AJAX请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我执行,其中第一我正在光标移动到等待状态(沙漏),然后我送一个synchrounous AJAX请求。之后得到我正在光标移动到默认状态响应的功能。

I am executing a function where first I am making cursor to wait state(hourglass) and then I am sending a synchrounous AJAX request .After getting the response I am making cursor to default state.

实际的code是这个..

The Actual Code is this..

//测试SMTP设置功能TestSettings(){    VAR buttonparams =新的对象();

// tests the smtp settingsfunction TestSettings(){ var buttonparams= new Object();

buttonparams.IsCommandButton = true;
buttonparams.ButtonId = "testsettings";
buttonparams.ButtonText = "Sending Test Mail...";
buttonparams.ButtonOrigText = "Test Settings";

if(buttonparams.IsCommandButton == true)
	HandleButtonStatus(true, buttonparams);

var request = function()
{
	var ret = SendForm(buttonparams);

	alert(ret);

}
window.setTimeout(request, 0);

}

功能SendForm(pButtonParams){    VAR HTTP;    VAR FORMDATA;

function SendForm(pButtonParams){ var http; var formdata;

http = yXMLHttpRequest();

http.open("POST", "./", false);
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
http.setRequestHeader("Req-Type", "ajax");
formdata = xEncodePair("_object", "PrefMgr")+ "&";
formdata += xEncodePair("_action", "SmtpTest")+ "&";
formdata += GetEncodedFormData();

http.send(formdata);

if(http.status == 200)
{
	if(pButtonParams.IsCommandButton == true)
		HandleButtonStatus(false, pButtonParams);

	return (http.responseText);
}
else
{

	return ("Error " + http.status + ": " + http.statusText);
}

}

功能HandleButtonStatus(pIsButtonStatusChange,pButtonParams){    VAR按钮= yById(pButtonParams.ButtonId);

function HandleButtonStatus(pIsButtonStatusChange, pButtonParams){ var button = yById(pButtonParams.ButtonId);

if(pIsButtonStatusChange)
{
        document.body.style.cursor = "wait";
	button.value = pButtonParams.ButtonText;
	button.disabled = true;

}
else
{
	document.body.style.cursor = "default";
	button.disabled = false;
	button.value = pButtonParams.ButtonOrigText;
}

}

推荐答案

尝试分配:

var st = document.body.style;

然后参照 ST 的两种功能。这可能是在AJAX回调函数范围的问题。

and then refer to st in both functions. This could be a scope issue in AJAX callback function.

编辑:使用回叫功能恢复光标形状。不要忘记的情况下AJAX调用失败这样做。

Use callback function to restore cursor shape. Don't forget to do the same in case AJAX call fails.

这篇关于为什么沙漏工作不与谷歌浏览器同步AJAX请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 21:49