phpknight Posted September 1, 2008 Share Posted September 1, 2008 Hi, I have figured out that AJAX can send the response back as XML or just text. I was having some issues until I realized that it would be easier to get the responseText and put it in the DIV. Unfortunately, it appears that the responseText is not exactly what I send back, rather it is what I send with everything encoded for HTML special characters! So, the source code just appears right on the page instead of what I want. How do I get around this? Link to comment https://forums.phpfreaks.com/topic/122192-problems-with-the-server-response-format/ Share on other sites More sharing options...
phpknight Posted September 1, 2008 Author Share Posted September 1, 2008 Here is the solution I have found. Somebody please let me know if I should be doing something else. The books I have do not cover any responses except xml. Instead of xml, I sent this as the header: header('Content-Type: text/html'); Then, it works great. Is there any reason I might not want to do it this way? Link to comment https://forums.phpfreaks.com/topic/122192-problems-with-the-server-response-format/#findComment-630819 Share on other sites More sharing options...
JasonLewis Posted September 1, 2008 Share Posted September 1, 2008 Only things that are displayed (echoing) will be sent back. What do you mean by the source is being sent back? Link to comment https://forums.phpfreaks.com/topic/122192-problems-with-the-server-response-format/#findComment-630820 Share on other sites More sharing options...
phpknight Posted September 1, 2008 Author Share Posted September 1, 2008 Right, that is what I want. The problem was when I was using the example from the book, it sent xml headers. So, when I tried to get the responseText property, it was giving me the code with all the tags written out as special characters, so then the actual source code showed up on the page--like <div>...</div> instead of a box. I'm not sure why it was converting all the characters, though. Link to comment https://forums.phpfreaks.com/topic/122192-problems-with-the-server-response-format/#findComment-630825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.