Jump to content

responsetext Alternative?


Petty_Crim

Recommended Posts

I'm making a simple Ajax thing that fetches data from a mysql database and then it sticks it in a new row in an existing table. I've got the main bit working but I'm stuck with the responseText function.

 

Since that only returns one big string and I have multiple columns which need to be seperate its kind of useless as I need to stick individual values in different cells not in 1 big cell. Is there another way where I can return the data as kind of like separate variables?

Link to comment
Share on other sites

Hello,

 

Two ways you can do

 

1.create the html in php and return i.e your responseText='<td>name</td><td>age</td><td>class</td>'

and print this directly.

 

2.return a string with a delimiter

name-age-class

hence your response text would be name-age-class then in javascript your can split this with the help of delimiter '-' and show as you want in the javascript.

 

Hope it helps

Regards

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.