hexduhax Posted November 24, 2013 Share Posted November 24, 2013 Hello im making and mvc framework , i have redirected all requests to index.php , so when i make an ajax request i recieve from there.The problem is that i dont know how to send back the xml response for the javascript function. can you help me ? Quote Link to comment https://forums.phpfreaks.com/topic/284230-how-to-send-an-ajax-php-response/ Share on other sites More sharing options...
Solution .josh Posted November 25, 2013 Solution Share Posted November 25, 2013 you just echo it out. Quote Link to comment https://forums.phpfreaks.com/topic/284230-how-to-send-an-ajax-php-response/#findComment-1459881 Share on other sites More sharing options...
hexduhax Posted November 25, 2013 Author Share Posted November 25, 2013 omg..... PHP responses respecting the requested method ,in my case was a xml request , 'echo' the do the job automatically thanks. Quote Link to comment https://forums.phpfreaks.com/topic/284230-how-to-send-an-ajax-php-response/#findComment-1459892 Share on other sites More sharing options...
.josh Posted November 25, 2013 Share Posted November 25, 2013 Well no, as far as php is concerned, it's just echoing out text. It doesn't care if it's xml or html or javascript or raw image data. It is your javascript that's doing something with it. Now, you can use header to set the content type as xml if you want but again, that's just sending that back to the browser; it's all just text to php, it's the browser and/or js doing something with it. Quote Link to comment https://forums.phpfreaks.com/topic/284230-how-to-send-an-ajax-php-response/#findComment-1459894 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.