AJAX request confusions-:

Thread Starter

terabaaphoonmein

Joined Jul 19, 2020
121

Its explanation-:

Confusions(“ie” means my interpretation that i am not sure if is correct or not)-:

1) user clicks invoking an event handler.
i.e when an user event occurs, it makes a javascript call. most likely user event=function call

2) handler's code creates xmlhttprequest object
ie that javascript call creates xmlhttprequest in ajax engine.

3) xhr requests file from server

4) server sends the file.

5)NOW I AM CONFUSED.
the terminologies are confusing me.
like-:
a) xhr fires an event. what does that mean? and why to fire an event? Doesn’t user only fire event? Like clicking,pressing some key etc.

b) you can attach handler function to event. (maybe it is trying to talk about event handler i.e if event->handlerfunction() )..I am not sure.

handler fxn then processes the data and displays it.
 

BobaMosfet

Joined Jul 1, 2009
2,211
javascript is how the events are caught on the browser side and the javascript code creates the xmlhttprequest object. It's just an object which acts as a shuttle via headers back to the server where a back-end script (php or something else) is called to grab the data and throw it back to the browser.

'xhr' - xml header. AJAX isn't magic. It's just using the http header mechanism to send request back to the server without reloading the hole page.

I recommend you look up an ajax tutorial for your preferred client (aka browser) side, and your server-side programming languages.
 
Top