<div id="content" style="display:none">数据正在载入,请稍候...<div>
<a href="#" onClick="loadingMain();">主页</a>//点这个链接就显示content
<script>
$(document).ready(function() {
$("#content").ajaxStart(function(){
$(this).show();
});
});
</script>//是不是说我在任何时候使用ajax都调用ajaxstart?
<script>function loadingMain(){
$.get("test1.asp");
}</script>我这样写对吗??要不帮忙改改
<a href="#" onClick="loadingMain();">主页</a>//点这个链接就显示content
<script>
$(document).ready(function() {
$("#content").ajaxStart(function(){
$(this).show();
});
});
</script>//是不是说我在任何时候使用ajax都调用ajaxstart?
<script>function loadingMain(){
$.get("test1.asp");
}</script>我这样写对吗??要不帮忙改改
这是APIajaxStart和ajaxStop主要是在页面触发ajax时,呼叫其他function或程式码做处理。这是例子:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery ajaxStart() Example</title>
<script type="text/javascript"src="jquery.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
$("div#divStatus").ajaxStart(function () {
$(this).html("Contacting the server");
}).ajaxStop(function () {
$(this).html("Response received.");
});
});
//function to get customer information
function requestCustomerInfo() {
//get the ID
var sId = $("input#txtCustomerId").val(); //send the request
$("div#divCustomerInfo").load("GetCustomerData.aspx?id=" + sId);
} //]]>
</script>
</head>
<body>
<p>Enter customer ID number to retrieve information:</p>
<p>Customer ID: <input type="text" id="txtCustomerId" value="" /></p>
<p><input type="button" value="Get Customer Info" onclick="requestCustomerInfo()" /></p>
<div id="divStatus" style="color: blue"></div>
<div id="divCustomerInfo"></div>
</body>
</html>
$.get("test1.asp");
}我想不让这个ajax调用全局的ajaxStart说加个global:false 是这样写吗?
function loadingMain(){
$.get("test1.asp",{global:false });
}
url: 'test1.asp',
type: 'GET',
global:false ,
....