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