php - javascript S.get to check already exist data -
this question has answer here:
- how return response asynchronous call? 24 answers
the following function used check value present in table or not.all other database related process ok here in given function give me alert of existing value submit form.but want when matches same value in table .the form cant submited.i cant find problem in given code please held tried out using post not working.thanks
function validateeditbranch() { var branch_city = document.forms['e_branch_form']['e_branch_city'].value; branch_city=branch_city.trim(); if(branch_city == "" ){ alert("please, enter branch city"); document.forms['e_branch_form']['e_branch_city'].value=''; return false; }else { $.get("?action=database_manage&ex_e_branch="+branch_city,function(data){ if(data) { alert("already exist"); return false; }else{return true;} }); } }
you should console.log(data) , console.log(branch_city), see in var data , var branch_city. hep find solution.
Comments
Post a Comment