html
<input type="text" name="PName" />
<input type="text" name="PAddress" />
<input type="text" name="PCity" />
mysql table
________________________________________________________
| id |PName | PAddress | PCity |
| ----|-------------------------------------------------|
| 1 | John | po box no xyz | Florida |
?????????????????????????????????????????????????????????
now my question is how do i use ajax to fetch the address and city when i enter the name? any help is appreciated
A while ago, i did a “live” search for my project, so here is some code modified for your needs (i assume you have jQuery on your page).
First of all i suggest you give your inputs some id’s:
After that you can bind a keyup event of PName field:
The js function to fetch the data:
And ofcourse the
getUser.phpfile:Good luck! ^^