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
https://forums.phpfreaks.com/topic/83457-responsetext-alternative/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.