為什么Ajax腳本不在IIS 7.5 Win 2008 R2服務(wù)器上運行?我有一個Web應(yīng)用程序在我的開發(fā)服務(wù)器上的VS 2013上運行良好,但是一旦我在IIS 7.5 2008 R2服務(wù)器上發(fā)布了它,位于我的自定義腳本文件中的Ajax腳本就不再工作了,盡管其他不調(diào)用Ajax的JQuery腳本確實正常工作。為了讓Ajax在服務(wù)器上工作,還有什么需要做的嗎?我讀過一些有關(guān)的帖子,但還沒有找到答案。我在IIS和Ajax方面的經(jīng)驗有限。/最新情況:我已經(jīng)知道Ajax腳本是可行的,問題最有可能出現(xiàn)在下面的行中:“url:‘/home/GetRates’,/URL用于請求”使用調(diào)試器,我發(fā)現(xiàn)在遠程服務(wù)器中沒有調(diào)用GetRates()函數(shù),盡管它位于本地(VS 2013)開發(fā)服務(wù)器中。唯一不同的是,我看到的是道路,但不知道如何修復(fù)它。下面是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' + "</br>" + 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;
});});
2 回答

天涯盡頭無女友
TA貢獻1831條經(jīng)驗 獲得超9個贊
如何調(diào)試Ajax調(diào)用
轉(zhuǎn)到進行ajax調(diào)用的網(wǎng)頁 在鉻壓機F12中 轉(zhuǎn)到“網(wǎng)絡(luò)”選項卡 通過提交表單#ReservSearch激活A(yù)jax調(diào)用 在“網(wǎng)絡(luò)”選項卡中,查找對/home/GetRates的調(diào)用 點擊它 檢查預(yù)覽和響應(yīng)選項卡,查看服務(wù)器的輸出 它是否顯示您的Ajax調(diào)用正在偵聽的預(yù)期HTML數(shù)據(jù)?
- 2 回答
- 0 關(guān)注
- 813 瀏覽
添加回答
舉報
0/150
提交
取消