I have the following code in jQuery. I have e.stopImmediatePropagation() and return false so that the code does not continue to where it does the POST. How can I prevent the code from continuing?
$("#saveBtn").on("click", function (e) {
var obj = { name: $("#sName").val() };
$.ajax({
url: '@Url.Action("CheckExist", "PMP")',
type: "GET",
async: true,
data: obj,
success: function (data) {
if (data != null) {
if (data == 'True')
{
alert('HERE');
e.stopImmediatePropagation();
return false;
}
}
}
});
// I WANT THE CODE TO NOT DO THE POST IF data == 'True' but it seems to continue regardless of return false
$.ajax({
type: "POST",
url: data_appRootPath + "@Url.PMPActionUrl((object)@ViewBag.Org_ID,
"GetType", null, null, null)",
contentType: false,