I am just starting to look at JQuery; until now everything has been PHP.
Just curious: if the server detects an event and wants to update the user's browser, can I do server push, or does the client have to poll?
jQuery is a small and lightweight JavaScript library. jQuery is cross-platform. jQuery means "write less do more". jQuery simplifies AJAX call and DOM manipulation. In this tutorial, you will get a lot of jQuery examples to understand the topic well. Let's see a simple jQuery example.
Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice. What's New in jQuery UI 1.13?
Will jQuery work in all browsers? The jQuery team knows all about cross-browser issues, and they have written this knowledge into the jQuery library. jQuery will run exactly the same in all major browsers.
The jQuery library contains the following features: 1 HTML/DOM manipulation 2 CSS manipulation 3 HTML event methods 4 Effects and animations 5 AJAX 6 Utilities
Client has to poll, but you can do long polling, i.e. keep the request alive until the server has an event to push back (i.e. complete request).
Otherwise, you can use Web Sockets.
The HTTP protocol works on the request-response principle which means that the server can only generate a response following a request from the client. This means that the server cannot send a response to the client without having received a request in the first place. This is not a PHP issue, it is an HTTP issue. So no, you can't push, the client has to make a request, or poll. You could take a look at long polling, as alex suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With