这是similar to this question,但这并没有解决我的问题,因为这正是我处理这个问题的方式。
$("#code").live("change", function() {
var data = { codeId: $(this).find(":selected").attr("id") };
$.ajax({
type: "GET",
url: codeUrl,
data: data,
success: function(html) {
// never gets hit if EmptyResult();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
// never gets hit until page navigation, which aborts this call
}
});
}); [HttpGet]
public ActionResult CodeParameters(int codeId)
{
IList<AdjustmentParameter> parameters = GetCodeParameters(codeId);
if (parameters == null || !parameters.Any())
return new EmptyResult();
return PartialView("EditorTemplates/AdjustmentParameters", parameters);
}任何返回HTML的代码都可以正常工作,但是任何返回new EmptyResult()的代码似乎都会中断ajax调用。我应该做些不同的事吗?奇怪的是,这种情况并不发生在3种不同的web服务器上,只发生在面向公众的服务器上(自然)。
发布于 2011-05-25 15:57:40
我在Fire上遇到了一个EmptyResult的问题。修正了当我在ajax选项中指定dataType: 'html'时。
https://stackoverflow.com/questions/6127122
复制相似问题