I've been staring at this issue for a few hours. I had a boilerplate code sample I was working off as follows
$('.save_stuff').on("click", function(e)
{
e.preventDefault();
e.stopPropagation();
preprocessAddProvisioning();
var mac = $('#c_mac_address').val();
var make = $('#c_make').html();
var model = $('#c_model option:selected').text();
var regex = /[a-zA-Z0-9]{12}/g;
if (mac.match(regex) && validateNewDevice())
{
$.ajax({
url: "/SomeUrl",
dataType: 'json',
type: 'POST',
async: false,
data:
{
mac: mac,
model: model,
make: make
},
success: function(data)
{
if (data.success)
{
$('#someValue').hide();
$('#modalNewDevice').modal('hide');
if (someValue !== undefined && !someValue.snom_mac_success)
{
window.location.href = "/SomeUrl?id="+someValue.newId+"&someValue=false";
}
else
{
window.location.href = "/SomeUrl?id="+data.newId;
}
}
else
{
$('#c_msg').html(data.msg);
$('#c_msg').closest('.form-group').addClass('has-error');
}
},
error: function()
{
}
});
}
});
With the method called being;
function preprocessAddProvisioning()
{
$('#mac_load').show('fast');
}
Can someone tell me why, async: false, stops preprocessAddProvisioning() being called? I realize it's implication when thinking about the context of the ajax request, but not of the context of the listener.
Many thanks