Как отлаживать вызовы AJAX?Jquery

Программирование на jquery
Ответить
Anonymous
 Как отлаживать вызовы AJAX?

Сообщение Anonymous »

У меня есть веб-приложение, которое отлично работает в VS 2013 на моем сервере разработки, но как только я опубликовал его на сервере IIS 7.5 2008 R2, сценарии Ajax, расположенные в моем файле пользовательского сценария, больше не работают, хотя другие сценарии JQuery, не вызывающие Ajax, работают правильно. Есть ли что-нибудь еще, что нужно сделать, чтобы ajax работал на сервере? Я прочитал несколько сообщений об этом, но пока не нашел ответа. У меня ограниченный опыт работы с IIS и Ajax.

// Обновление:

Я уже разобрался что Ajax-скрипт работает и проблема, скорее всего, в следующей строке:

"url: '/Home/GetRates', // URL для запроса" < /p>

Использование найденного мной отладчика выяснилось, что функция 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;
});
});


// ВТОРОЕ ОБНОВЛЕНИЕ

После следования инструкциям в разделе комментариев, это ответ от ajax звоните:

Server Error in Application "DEFAULT WEB SITE"
Internet Information Services 7.5


Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.


Detailed Error Information


ModuleIIS Web Core
NotificationMapRequestHandler
HandlerStaticFile
Error Code0x80070002




Requested URLhttp://localhost:80/Home/GetRates
Physical PathC:\inetpub\wwwroot\Home\GetRates
Logon MethodAnonymous
Logon UserAnonymous







Most likely causes:
  • The directory or file specified does not exist on the Web server.
  • The URL contains a typographical error.
  • A custom filter or module, such as URLScan, restricts access to the file.

Things you can try:
  • Create the content on the Web server.
  • Review the browser URL.
  • Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.

Links and More Information
This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
View more information »








Подробнее здесь: https://stackoverflow.com/questions/215 ... ajax-calls
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Jquery»