Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

SOLVED - ABP AJAX Call - How to handle failure #3156


User avatar
0
exlnt created

I am using the below code for my AJAX JS calls

abp.ajax({
        url: '/Address/GetStates',
        data: JSON.stringify({ CID: countryId })
    }).done(function (data) {
        $.each(data, function (i, state) {
            $("#EditState").append('<option value="' + state.value + '">' + state.text + '</option>');
            if (selectedVal != null && $.trim(selectedVal) == $.trim(state.value)) {
                $("#EditState").val($.trim(state.value));
            }
        });
    }).fail(function () {
        abp.notify.error('Get States failed!')
    });

In the above code the .fail is NOT getting hit. It keeps displaying the default alert message as per the ABP AJAX docs (<a class="postlink" href="https://www.aspnetboilerplate.com/Pages/Documents/Javascript-API/AJAX">https://www.aspnetboilerplate.com/Pages ... t-API/AJAX</a>). I want the notify message to be displayed rather than the default ABP alert message.


2 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Did you try to add abpHandleError: false into abp.ajax options?

  • User Avatar
    0
    exlnt created

    Thanks for pointing that setting out! I completely missed that! :o