Jump to content

newbie to ajax - response is not formatted correctly.


dotolee

Recommended Posts

hi there.  i'm following an example found here: http://www.w3schools.com/php/php_ajax_database.asp

in their example, the page that gets the new data from the database returns a table.

 

so here are my questions.  why do we need to "echo" the results back? 

also, when i do a view source on my main page, i don't see the latest values that get gnereated by the ajax code.  i see the table values that initially display when i open the main page.

is this correct? again, is this because the echo?

why do we need to "echo" the results back?

 

You don't As per usual w3schools have published a terrible example of PHP.

 

when i do a view source on my main page, i don't see the latest values that get gnereated by the ajax code.

 

Javascript adds elements directly to the DOM. You won't see it in a normal "view source". Use a more robust tool like Firebug or Chrome's  dev tools.

why do we need to "echo" the results back?

 

You don't As per usual w3schools have published a terrible example of PHP.

 

when i do a view source on my main page, i don't see the latest values that get gnereated by the ajax code.

 

Javascript adds elements directly to the DOM. You won't see it in a normal "view source". Use a more robust tool like Firebug or Chrome's  dev tools.

so what is the proper way to send a response back to the calling page? or do you just write straight html as you normally would..

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.