这适用于我的开发机器,但不适用于生产服务器。我正在尝试使用 ajax 更新一些 div,但它们没有更新,尽管其他部分工作正常。我在服务器上使用 IIS 6。
当我使用 firebug 在服务器端调试此代码时,它不会命中我添加到 success 函数中的任何断点。
Script:
function updateServiceInfo(nodeId) {
var id = { id: nodeId };
$.ajax({
url: '/ServiceInfo/ServiceInfoPartial',
type: 'GET',
data: id,
dataType: 'html',
success: function (data) {
$('#serviceInfoContent').html(data);
},
error: function (request, error) {
}
});
}
控制器:
public class ServiceInfoController : Controller
{
public ActionResult ServiceInfo()
{
return PartialView("ServiceInfo");
}
public ActionResult ServiceInfoPartial(string id)
{
return PartialView("ServiceInfoPartial");
}
}
Views:
服务信息部分
@model string
<p>
Немає опису</p>
服务信息
<div id="serviceInfo">
<div id="ContainerPanel" class="ContainerPanel">
<div id="serviceInfoHeader" class="collapsePanelHeader">
<div id="dvHeaderText" class="HeaderContent">
Опис сервісу</div>
<div id="dvArrow" class="ArrowClose">
</div>
</div>
<div id="serviceInfoContent" class="serviceInfoContent">
</div>
</div>
</div>
控制台返回的响应是
GET http://localhost/Managers/GetManagers?nodeId=563344 404 Not Found 42ms