samedi 1 août 2015

ajax success function not firing after json return from controller in entity frame work 6

In the controller returning a json like below return Json(lstCountry, JsonRequestBehavior.AllowGet);

but always returning error: is fired from ajax why? My ajax code is : $.ajax({ type: "POST",

        url: "/Country/Update",
        data: { id:$('#id').val(), name:$('#country').val() },

        dataType: 'json',
        async: true,
        cache: false,
        success: function (data, status, jqXHR) {
            alert("success");
            //$.each(data, function (index, customer) {
            //    alert(customer.Name + " " + customer.UserName);
            //});
        },
        error: function (jqXHR, textStatus, errorThrown) {

            if (typeof (console) != 'undefined') {
                alert("oooppss");
            }
            else { alert("something went wrong"); }
        }
    });
});

Aucun commentaire:

Enregistrer un commentaire