This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 7 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • notification notshows #77932

    rajan
    Participant

    Here i want to show notification for “Country already exists” which is in “if” condition within post method.
    but it first execute else part notification as well as if condition also.

    $(“#btnSubmit”).click(function () {
    if ($(‘#rForm’).jqxValidator(‘validate’)) {//add edit data
    var hidSectorId = document.getElementById(“hidSectorId”);
    var err = 0;

    $.post(“handlers/Country.ashx?nd=” + new Date().getTime(), { mode: mode, CountryId: $(“#hidCountryId”).val(), sectorId: $(“#hidSectorId”).val(), Country: $(“#txtCountry”).val(), cDefault: $(“#chkDefault”).is(“:checked”), createdBy: $(“userId”).val(), modifiedBy: userId }, function (data) {
    if (data.toLowerCase().indexOf(“errornumber”) >= 0) {
    err = 1;
    alert(‘err = 1’);
    $(“#notificationmsg”).text(“Country already exists”);
    $(“#messageNotification”).jqxNotification(“open”);
    }
    else {
    BindGrid(data);
    }
    });

    if (err == 0) {
    alert(‘err = 0’);
    if (mode == ‘A’) {
    $(“#notificationmsg”).text(“Record added sucessfully”);
    }
    else {
    $(“#notificationmsg”).text(“Record updated sucessfully”);
    }
    $(“#popupWindow”).jqxWindow(‘close’);
    $(“#messageNotification”).jqxNotification(“open”);
    }
    }
    else {
    $(“#msgvalidation”).jqxNotification(“open”);
    }
    });

    notification notshows #77956

    Dimitar
    Participant

    Hello rajan,

    If you wish the success callback to be called before

    if (err == 0) {
        alert('err = 0');
        ...

    you would have to make your POST request synchronous by using jQuery.ajax() with async: false instead of jQuery.post().

    Please note, however, that this issue is not actually related to jQWidgets.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.