I’m making an auction site like BidRivals and in my website the auction script works but the code is very poor and by that i mean that i have to automatically refresh the page every 5 seconds so that the user can see if there are new bids to the products.
I’m trying to optimize my code so that the page only refreshes if there are new bids, otherwise it doesn’t.
I was told to use xmlHttpRequest but i never used it before and know how that works.
Already went to w3schools did some research but i found nothing to my case.
Any ideas?
A much better approach than using
XMLHttpRequestwould be to use jQuery.It’s better because jQuery removes most of the burden of cross-platform compatibility from the developer. Also, jQuery is a very useful library for doing many common things in javascript, and as such, is very helpful to know.
On some/many browsers, jQuery’s Ajax methods are implemented using
XMLHttpRequest.