From your post, I assume that you are calling a function that contains $.ajax()
, and try to return false
to that function. but you cannot do this because AJAX is asynchronous.
It is better to call a function from the ajax success function, for example:
$.ajax({ url: '' + $website_url + 'queries/voorraad_berekenen.php', type: 'post', data: { aantal: $(this).parent('form').children('.quantity').val(), item_number_1: $(this).parent('form').children('.item_number_1').val() }, success: function(result) { var returned = true; if(some_condition_not_satisfied) { returned = false; } else { }
source share