0
嗨,我使用JQueryjQuery函數不調用時JQuery的阿賈克斯方法成功
$(document).ready(function() {
var imgPoll = new Image();
imgPoll.src = 'images/red-bar.png';
if ($("#divVoted").length > 0) //Already voted
{
animateResults();
}
else {
$("#rdoPoll0").attr("checked", "checked"); //default select the first Choice
$("#btnSubmit").click(function() {
$("#divPoll").css("cursor", "wait"); //show wait cursor inside Poll div while processing
$("#btnSubmit").attr("disabled", "true") //disable the Vote button while processing
var pID = $("input[id$=hidPollID]").val(); //get Poll ID
var cID = $("input[name='rdoPoll']:checked").val(); //get the checked Choice
var data = "{'pID':'" + pID + "', 'cID':'" + cID + "'}"; //create the JSON data to send to server
jQuery.ajax(
{
type: 'POST',
data: data,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
url: 'Poll_CS.aspx/UpdatePollCount',
success: function(msg) //show the result
{
//alert("valid");
$("#divPoll").css("cursor", "default"); //remove the wait cursor
$("#btnSubmit").attr("disabled", "false") //enable the Vote button
$("div[id$=divAnswers]").fadeOut("fast").html(msg.d).fadeIn("fast", function() { animateResults(); });
}
});
});
}
function animateResults() {
$("div[id$=divAnswers] img").each(function() {
var percentage = $(this).attr("val");
$(this).css({ width: "0%" }).animate({ width: percentage }, 'slow');
});
}
});
Jquery.ajax的成功方法animateResults()
功能不調用後在asp.net做的一個小應用程序。 在本地服務器中工作正常,而在主機服務器中工作不正常。
請給予建議,以解決這一問題
感謝 Ganesh神
你會工作在你的代碼格式,所以我們可以讀它嗎? – 2010-11-20 05:47:48
我可能是錯的,但我懷疑如果相同的代碼在一臺機器上運行,但不在另一臺機器上,我們可以提供幫助;看看這兩臺機器之間的差異比相同的一段代碼更有意義。 – BeemerGuy 2010-11-20 05:55:12
比較兩個服務器上的JavaScript文件,如果您可能忘記部署最新的文件等,除此之外不應該有任何理由說明它爲什麼只能在一臺機器上運行,而不能在其他機器上運行。 – kobe 2010-11-20 08:00:13