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.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top