iis ajax访问html,为什么Ajax脚本不在IIS 7.5 Win 2008 R2服务器上运行?

在IIS7.5 Win2008 R2服务器上,一个Web应用程序的Ajax脚本无法正常运行,尽管在VS2013开发环境中一切正常。其他非Ajax的JQuery脚本在服务器上运行良好。问题可能出在Ajax请求的URL '/Home/GetRates',在服务器上没有调用到对应的GetRates()函数。已通过调试器确认此问题,但尚未找到解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

为什么Ajax脚本不在IIS 7.5 Win 2008 R2服务器上运行?

我有一个Web应用程序在我的开发服务器上的VS 2013上运行良好,但是一旦我在IIS 7.5 2008 R2服务器上发布了它,位于我的自定义脚本文件中的Ajax脚本就不再工作了,尽管其他不调用Ajax的JQuery脚本确实正常工作。为了让Ajax在服务器上工作,还有什么需要做的吗?我读过一些有关的帖子,但还没有找到答案。我在IIS和Ajax方面的经验有限。

/最新情况:

我已经知道Ajax脚本是可行的,问题最有可能出现在下面的行中:

“url:‘/home/GetRates’,/URL用于请求”

使用调试器,我发现在远程服务器中没有调用GetRates()函数,尽管它位于本地(VS 2013)开发服务器中。唯一不同的是,我看到的是道路,但不知道如何修复它。下面是Ajax脚本:// Retrieve rates and update partial view$(function () {

$('#reservSearch').submit(function () {

if ($(this).valid()) {

$("#theModal").modal("show");              // Display the in progress.....

$.ajax({

url: '/Home/GetRates',                 // URL for the request

data: $("#reservSearch").serialize(),  // the data to send (will be converted to a query string)

type: "POST",                          // whether this is a POST or GET request

dataType: 'html',                      // the type of data we expect back

success: function (data) {   // code to run if the request succeeds; The response is passed to the function

$("#theModal").modal("hide");      // Close the in progress modal.....

$('#ratesView').html(data);        // Fill div with results

},

error: function (xhr, status) {

// code to run if the request fails; the raw request and status codes are passed to the function

$("#theModal").modal("hide");      // Close the in progress modal.....

alert('Error: Retrieving parking rates' + "" + xhr.error);

}

});

}//        // it is important to return false in order to cancel the default submission of the form and perform the AJAX call

return false;

});});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值