0
Guys I dint get Ajax at all.any suggestions?
5 odpowiedzi
+ 4
The acronym "AJAX" is easy to be confused by because the acronym references things that are optional or are outdated.
AJAX expands to Asynchronous JavaScript and XML. Hardly anyone means XML when they say it so the X is misleading in AJAX. The most fundamental thing people usually mean when saying AJAX is JavaScript-generated HTTP requests. It is nearly always bad to do this but HTTP requests can even be sent synchronously so the first "A" in AJAX is sort of optional.
When someone says AJAX, just think of JavaScript running in a web browser sending HTTP requests and listening for a response.
If you want a few exercises to practice with AJAX, I suggest making HTTP requests and processing their responses a few different ways.
- Use fetch.
- Use the jQuery library's ajax method.
+ 4
Ore wrote, "Josh Greig What do you mean by "it is nearly always bad to do this"?"
Response:
I meant that it is nearly always bad to send an HTTP request synchronously.
It is bad to send HTTP requests synchronously because it locks up the browser making it less responsive until the response is found or the request fails. It requires strongly discouraged features that are getting deprecated. More details are mentioned at: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
+ 2
Josh Greig Oh. I thought you meant that it is bad to send HTTP requests with JavaScript.
+ 1
Josh Greig What do you mean by "it is nearly always bad to do this"?
+ 1
Alright I get it