jQuery UI Widgets › Forums › Dialogs and Notifications › Tooltip, Notification, Popover › notification notshows
Tagged: ajax, Angular notification, async, jQuery notification, jqxNotification, Notification, post, synchronous
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 8 years, 11 months ago.
-
Authornotification notshows Posts
-
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”);
}
});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,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.