views:

199

answers:

1

Hello there,

I'm making the following jQuery ajax call to an action in ASP.NET MVC. In Firefox the async request is sent to the action in the controller and everything works fine, but in IE no request is sent to the controller.

Here is the ajax call and action controller signature:

                            $.ajax({

                          cache: false,

                           type: "GET",

                            dataType: "json",

                            contentType: "application/json; charset=utf-8",

                            url: "/Fmz/AssignFmzToRegion",

                            data: { fmzId: 403, regionId: 409 },

                            success: function(message) {
                                if (message != 'Success')
                                    alert(message);
                            },

                            failure: function(message) {
                                alert(message);
                            }
                        });


    [HttpGet]
    public JsonResult AssignFmzToRegion(long fmzId, long regionId)
    {
        try
        {
            FacilityManagementZoneService.AssignFmzToRegion(fmzId, regionId);
        }
        catch (Exception e)
        {
            return this.Json(e.Message, JsonRequestBehavior.AllowGet);
        }

        return this.Json("Success", JsonRequestBehavior.AllowGet);
    }

Thanks.

+1  A: 

Change failure to error. See http://api.jquery.com/jQuery.ajax/ for the valid parameters/callback names

If your request is failing then properly handling the error callback should tell you what's going on

zincorp
Thanks, I change to "error" and inside this function, it throws [Object Error] exception. one step ahead now.
in the 'error' function, 'errorThrown' paramter has the value of 'Object Error' and 'textStatus' parameter is null. Do these mean anything specific?