PDA

View Full Version : Ajax responseText parsing ?



tralsi
10-04-2009, 05:55 AM
Hi All !

I am using PHP & My SQL for my testing rig. I have an HTML form having few fields on it like customer ID, phone no, postal address , email adress, date of purchase etc.

based on value of customer id , i am able to get his phone no from my SQL database & I am able to succefully retrieve it from the database using Ajax i.e. without refreshing the whole page.

I am able to fill one field i.e. phone no. , using ajax , but i want to fill rest of the form fields also which depends on custid like email adress & postal adress.

I can add email, cust_add, cust_email in my SELECT query along with the phone field but what do I do in when I receive responseText.

I mean how do i populate rest of the fields with the responseText I have received ? How do i place adress in form's address field & e-mail in email addres filed ?

Please guide.

Regards,

tralsi

jscheuer1
10-04-2009, 07:14 AM
As far as I know there is no standard method, it would depend upon how the responseText actually looks. If it has any obvious delimiters between the various data bits, and if the pattern of the responseText in these instances (as to which data bits come in what order) or if there is an easy way to tell which is which from their format, something can be worked out.

What does the responseText look like when it contains all of the information that you are interested in importing to your form? Is it always in the same order? If their is missing information, how (if at all) is that represented?