Any clues, how I would get this to work?
$( "#search_form" ).on('submit',function(event) {
ajax(function(response){
if (response.status == 'error'){
event.preventDefault();
alert(response.status,response.msg);
}else if(response.status == 'ok'){
alert(response.status,response.msg);
}
});
});
event.preventDefault(); is not being called, probably because it's out of scope in the ajax function. This line simply prevents the button from carrying out a post action. How would i insert it into the ajax function? I'm just learning about callbacks and this has thrown me
Thanks y'all