Using plain, native Javascript (no jQuery or other framework answers please), how does the response part of an AJAX call get processed and formatted before being sent back to the requesting script?
I have been looking for this answer and cannot seem to find it in the many searches I have performed. I would like to see an example, and not one focusing on the POST or GET variable access. I want to know how to respond to the script.
In PHP:
Part of an AJAX call is the function listening for the response – similar to how an HTTP request has your browser waiting for a webpage response. In this case the headers indicate the resulting data is in json format. If you do this totally by hand you will get a standardized text response which you will need to parse and package into javascript objects (Which you can do because javascript’s associative array syntax for objects makes it straightforward to set object properties with names pulled from strings.)