If i send a AJAX request to a HTML file the content of that file is returned. I can insert this into any element i wish
If i send a AJAX request to a PHP file the file is executed. If the PHP file has any embedded HTML or any echo() or print() commands the contents of it are returned and i can embed it into any element i wish If it only has code which does not display an output (such as mysql_query() functions) then it just runs in the background.
What happens if i send a JSON request via AJAX how do i use it?
if you specify type as json, then your called file should send back data in json format. if you use php, you could use json_encode function to convert an array to json. then in your browser app you can convert and use it.
Leave a comment on msd1811's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic