Q:

ajax call result issue occurring

I have a table with USERID,USERNAME,SALARY in a database. 
These records are displaying in an HTML table where USERID comes from the table and USERNAME and SALARY will be entered by the user in textbox. 
Here, on each on change of text box, ajax is calling and it will check whether USERNAME / SALARY present in the database for USERID (record for which USERNAME /SALARY is added) ?  If return yes, then it will fire edit query else it will fire insert query. 
Now, what is happening is as soon as record is added to textbox, ajax is calling and it is checking and this process is so fast that another ajax is calling before one has completed its process and so checking query returning false. 
My ajax is:
$.ajax({
 type:'post',
 url: url,
 data :{uid:uid,rec:rec,sal:sal},
 success:function(data) {
 console.log(data);
  }
});

A:

Add async :false to your ajax statement,so it will be like :
$.ajax({

type:'post',

url: url,

data :{uid:uid,rec:rec,sal:sal},

async : false,

success:function(data) {console.log(data);}

});

