Используя отладчик, который я обнаружил, что функция getRates () < /code> не была вызвана на удаленном сервере, хотя она находится на локальном (в разделе VS 2013) сервера разработки. Единственная разница, которую я вижу, - это путь, но не знаю, как его исправить.
ниже - сценарий Ajax: < /p>
// 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;
});
});
< /code>
Второе обновление < /h6>
После выполнения указаний в разделе комментариев это ответ от Ajax Call: < /p>
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
Module
IIS Web Core
Notification
MapRequestHandler
Handler
StaticFile
Error Code
0x80070002
Requested URL
http://localhost:80/Home/GetRates
Physical Path
C:\inetpub\wwwroot\Home\GetRates
Logon Method
Anonymous
Logon User
Anonymous
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
Мобильная версия