MHB Why is AJAX request terminology causing confusion?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Request
AI Thread Summary
The discussion centers around the process of handling user events in JavaScript, particularly in the context of AJAX requests using the XMLHttpRequest (XHR) object. It outlines the sequence of actions that occur when a user interacts with a web interface, such as clicking a button. This interaction triggers an event handler, which creates an XHR object to request data from the server. The server responds with the requested data, and the XHR fires an event to signal that the response is ready. Key points of confusion include the terminology surrounding events and handlers. It is noted that while user actions like clicks initiate events, the XHR object also fires events, specifically an HTTP response event, once the server's response is received. The discussion emphasizes the role of event handlers in processing these events and updating the user interface accordingly. Overall, the conversation seeks clarity on the relationship between user actions, event firing, and the handling of asynchronous requests in JavaScript.
shivajikobardan
Messages
637
Reaction score
54
https://lh5.googleusercontent.com/9QsQWXl9st7BwAufKwea7kxOpXwRzJCEIvN0MWmtaJy9aHgfopZQQ0pYHtcXfoNAJzGbP-x89zFcYwzI7FcZnNlHRI3eezngpJUJq1tPIYpCUImKTqvRlDTjScYf7n0jY9-NoMZLgl9dt-MOLQ
Its explanation-:
https://lh5.googleusercontent.com/CCx_IRo7MJecVwlnMs9nMSIoZ_xfnV1ZGjP8OeXUzrTWmj-njI9SI8B0ULE3RfLyft1LInYv7eWe3hCg-1PxKtQUamiY69mBLQTUewEkYsNtYIIyAxlw5Ik8B6N1mpZcHBy8Yu5N3hk1d_X41A
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.
 
Technology news on Phys.org
If a user clicks a button, the user interface engine fires an onClick event, which invokes whatever event handler has been attached to it. In this case it means an http request is sent out.
When the result of the http request comes back, the http engine (called xhr in this case) fires an http response event, which in the same fashion invokes whatever event handler has been attached to it. In this case the result is somehow presented in the user interface.
 
Klaas van Aarsen said:
If a user clicks a button, the user interface engine fires an onClick event, which invokes whatever event handler has been attached to it. In this case it means an http request is sent out.
When the result of the http request comes back, the http engine (called xhr in this case) fires an http response event, which in the same fashion invokes whatever event handler has been attached to it. In this case the result is somehow presented in the user interface.
thanks for reply.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top