比如
if(xmlhttp.readyState==4)
{
//...可以在这里把一个div显示出来,div里有个等待的图片,这样可以实现吗?
if(xmlhttp.status==200)
{ }
}各位大虾还有什么方法不?
if(xmlhttp.readyState==4)
{
//...可以在这里把一个div显示出来,div里有个等待的图片,这样可以实现吗?
if(xmlhttp.status==200)
{ }
}各位大虾还有什么方法不?
if (id == "")
return;
document.getElementById("userid_msg").innerHTML = "<img src='images/loading.gif' align='absMiddle'> 检查中,请稍候……";
var url = "../RegistValidate.ashx?username=" + escape(id);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ShowResult;
xmlHttp.send(null);
}
function ShowResult() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var s;
s = xmlHttp.responseText;
if (s== "OK")
document.getElementById("userid_msg").innerHTML = "<img src='images/correct.gif' align='absMiddle'>";
else
document.getElementById("userid_msg").innerHTML = "<img src='images/error.gif' align='absMiddle'>";
}
else {
document.getElementById("userid_msg").innerHTML = "<img src='images/error.gif' align='absMiddle'> 错误:" + xmlHttp.status;
}
}
}
上面那个我会
只是我现在是在做留言
插入数据库,还要发送邮箱给对方(用ajax做的)
这样会有点慢!用户等得不知道还会在点一次!不想要用enable的!
想点击留言的时候弹出个层,层里显示一个加载的图片...正在加载中....大家帮帮忙!
function GetEx(firstDate, endDate, Currency) {
$('#post').html("<img src='../images/ui/loading.gif'>");//等待图片
$.ajax({
url: "HuiLvBaoBiao.aspx", //目标URL
data: "firstDate=" + firstDate + "&endDate=" + endDate + "&Currency=" + Currency,// 参数
error: function() {
alert('出错啦');//错误信息
},
success: function(v) {
$('#post').html(v);//返回结果显示在DIV中
}
});
}#post 是DIV的ID叫post