Looking for Some Ajax Advice
My experience with Ajax is very low to nonexistent. I am looking to implement a form with an auto-fill feature. The form will have name, phone, email, etc. When I am filling out this form, the database may already have some of this information. So when I enter the name and tab to the next field, I want an ajax request sent to the server and check for existing records. If one is found, I want it to pull that information, and fill in the rest of the form for me.
So in simple terms, I want to sent 1-2 fields to the server, and receive up to 12 back. Would you recommend that I use a framework or start from scratch. And are there any good tutorials to start with?
decibel.places posted this at 16:45 — 2nd August 2008.
He has: 1,494 posts
Joined: Jun 2008
I, too, have limited experience with AJAX
IMO it is overused, when some basic client-side JS will do without the additional server requests
Your sitch seems well suited for AJAX
Have a look at HotScripts
--and happy modding!
kazimmerman posted this at 18:34 — 2nd August 2008.
He has: 698 posts
Joined: Jul 2005
If I have a little bit of time later I'll work on a quick script. It's really quite simple once you get the JavaScript part down. Here are two great tutorials that I read through that explain what's going on and what's needed to run a simple AJAX script:
http://www.openjs.com/articles/ajax_xmlhttp_using_post.php
http://www.phpbuilder.com/columns/jon_campbell20070730.php3
Basically, whichever two fields you want to be analyzed will be sent as the parameters just as if it was a GET method form (e.g. formAction.php?field1=value1&field2=value2) so I suggest getting the fields' values by their ID using JavaScript. Then the URL should point to a PHP script that will handle the parameters just like any regular form and should return, echo, or print something which will be handled as the http.responseText which will be used to fill in the rest of the fields. I would suggest returning an array with the data but I'm not sure exactly how it would work.
Best of luck, and as I said, I'll work on something more official later on if I have some time.
Kurtis
pr0gr4mm3r posted this at 19:49 — 12th August 2008.
He has: 1,502 posts
Joined: Sep 2006
Thanks for the articles - very helpful. I have gotten a page up and running with less pain then I remember with I last dealt with JavaScript .
I'm not sure how to handle the returned data. Should I go all out and return it in XML format and parse it on the client side? The only easier way I can think of would be to use a separator and use some equivalent to PHP's explode() function.
gainza34 posted this at 12:17 — 23rd March 2009.
They have: 14 posts
Joined: Mar 2009
I like to start a new website in which I will use Java programming but few of my friends told me to use Ajax. I am not much satisfied with Ajax. So, what should I use now. Any help please.
Thanks a lot.
casas rurales en asturias |casas rurales en cantabria
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.