Jump to content

Help with retrieving data from mysql with ajax


DataSpy

Recommended Posts

Hello, I'm a total newbie with ajax and was wondering if anyone could point me in the right direction of a tutorial that would help me accomplish what I'm looking to do.  I want to be able to type a phone number into a text field, then hit tab and have the customer info populate from the phone number.

 

Any help greatly appreciated,

thanks in advance!!!!

Link to comment
Share on other sites

the query code will be in the php page that your AJAX page is linked to...as far as the tab button is concerned,  i'm not sure how to accomplish this, perhaps you can create a function that will detect when a space/tab has been entered into the field, then act accordingly when this occurs

Link to comment
Share on other sites

The javascript function to use is onblur, that's what will retrieve the data after hitting tab.  I'm still looking for a tutorial to explain exactly what I'm looking for though :(

 

I couple that I've found that help are:

http://www.w3schools.com/php/php_ajax_database.asp

http://roshanbh.com.np/2008/04/check-username-available-ajax-php-jquery.html

 

I think I'll be able to figure it out but it's going to take some time to combine these two tutorials!

 

Thanks for the help!  If anyone knows of a tutorial that will retrieve data from a database and populate other fields with an onblur function I would greatly appreciate it!

Link to comment
Share on other sites

have you looked at the links I provided?

this really isn't difficult, basically you will want to use an onblur event that will call an AJAX/Jquery function that will get the customer data from your php file

Link to comment
Share on other sites

basically you will want to use an onblur event that will call an AJAX/Jquery function that will get the customer data from your php file

Exactly, the problem is I'm stupid :)  While I may know PHP and MySQL, I've never really used Javascript before so I'm definitely having a hard time!

 

I'm currently watching a very informative video and it explains at least half of what I want, I still have to work on the onblur function but that'll come after I can actually read data from the db :)

 

Video http://www.tut-cast.com/jquery/php-tutorials-get-data-from-mysql-database-without-refreshing-jquery-video_6cfbfd766.html

 

Thanks :)

Link to comment
Share on other sites

Exactly, the problem is I'm stupid  While I may know PHP and MySQL, I've never really used Javascript before so I'm definitely having a hard time!

 

lol...i'm sure you aren't stupid  ;D

well the AJAX link that I gave you will give you a step by step on creating an AJAX xhr and will give examples of sending data to a php file via the get and post methods

Link to comment
Share on other sites

Exactly, the problem is I'm stupid  While I may know PHP and MySQL, I've never really used Javascript before so I'm definitely having a hard time!

 

lol...i'm sure you aren't stupid  ;D

well the AJAX link that I gave you will give you a step by step on creating an AJAX xhr and will give examples of sending data to a php file via the get and post methods

 

Thanks for all of your help!!!  I'll definitely look into that!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.