DataSpy Posted July 8, 2011 Share Posted July 8, 2011 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!!!! Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/ Share on other sites More sharing options...
AyKay47 Posted July 8, 2011 Share Posted July 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1239923 Share on other sites More sharing options...
DataSpy Posted July 8, 2011 Author Share Posted July 8, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1239943 Share on other sites More sharing options...
AyKay47 Posted July 8, 2011 Share Posted July 8, 2011 yeah when you hit tab it will blur the text field, how dumb of me...one of the resources that you have shown should not be fully trusted,as a word of advice visit this thread that gizmo made..http://www.phpfreaks.com/forums/index.php?topic=337995.0 Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240057 Share on other sites More sharing options...
DataSpy Posted July 8, 2011 Author Share Posted July 8, 2011 Thanks! Ya I'm still looking for a tutorial for what I need I've made a small amount of progress but unfortunately I suck at javascript Right now I'm messing around with http://www.phpsimplicity.com/articles/xmlhttprequest.htm but I'm having a little trouble, I'm sure I'll figure it out though Thanks again for the tip! Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240087 Share on other sites More sharing options...
AyKay47 Posted July 8, 2011 Share Posted July 8, 2011 is the customer information stored inside of a database? If so, you will need to use a server side language to extract the data, preferribly PHP of course. For this i would recommend you use either AJAX or JQuery https://developer.mozilla.org/en/AJAX http://jquery.com/ Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240103 Share on other sites More sharing options...
DataSpy Posted July 8, 2011 Author Share Posted July 8, 2011 I'm using PHP and MySQL and I've looked into both ajax and jquery, I just can't find a good tutorial for what I want , I'm still searching though Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240112 Share on other sites More sharing options...
AyKay47 Posted July 8, 2011 Share Posted July 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240115 Share on other sites More sharing options...
DataSpy Posted July 8, 2011 Author Share Posted July 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240119 Share on other sites More sharing options...
AyKay47 Posted July 8, 2011 Share Posted July 8, 2011 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 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 Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240128 Share on other sites More sharing options...
DataSpy Posted July 8, 2011 Author Share Posted July 8, 2011 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 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! Quote Link to comment https://forums.phpfreaks.com/topic/241382-help-with-retrieving-data-from-mysql-with-ajax/#findComment-1240134 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.