I'm having a difficult time trying to get this javascript function to return false inside of a .post() function.
Is this even possible? or is there another way to do a simple ajax check to validate the voucher code is in the database.
function check_options(){
var voucher_code = $('#voucher_code').val();
$.post(baseURL+"ajax.php", { tool: "vouchers", action: "check_voucher", voucher_code: voucher_code },
function(data) {
if(data == 'invalid'){
// NEED TO RETURN FALSE FOR THE MAIN FUNCTION
}
});
}