开发者

jQuery AJAX request bombs on EmptyResult

开发者 https://www.devze.com 2023-03-08 03:42 出处:网络
This is similar to this question but this did not solve my problem since this is exactly how I\'m handling this.

This is similar to this question but this did not solve my problem since this is exactly how I'm handling this.

    $("#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();

      开发者_JAVA技巧  return PartialView("EditorTemplates/AdjustmentParameters", parameters);
    }

Any code that returns HTML works as expected but any code that returns new EmptyResult() seems to break the ajax call. Should I be doing something differently? Strangely enough this does not happen on 3 different web servers, only on the public facing server (naturally).


I ran into an issue in Fire Fox with an EmptyResult. Fixed when I specified the dataType: 'html' in the ajax options.

0

精彩评论

暂无评论...
验证码 换一张
取 消