I am using async:false. Therefore in case of success function, it should wait till it gets a response from the function and should stop executing the code that follows the success function.
However it executes the code following it. Shouldn't async lock the process? Now in mycase, I am making $('#val1loading').text('loading') which has to keep showing loading until it gets a success from the ajax call. But it doesn't.
$("#val").change(function() {
$('#val1loading').text('loading');
if ($('#val').val() != '') {
$.ajax({
url: "Functions.php",
dataType: 'json',
data: {
async: false,
'link': $('#val').val()
},
success: function(result) {
$("#val1").val(result[0]);
},
error: function(xhr, status, error) {
$("#val1").val('');
}
});
} else {
//some code
}
$('#val1loading').text('');
});