This is a memo post. It should fall under the wiki, but for some reasons, I find it more comfortable to write in my regular editor. Thanks again Jekyll. What a relief. So flexible.
Simple ajax call on click of a button. the success indicates the function used on success.
The idea being to call a server and getting a response, ajax can of course do way more.
settings object can have pretty much all the options a request needs to go through.
Check the API references here
For reference, my best move so far to understand what’s going on under the hood has been spending time trying to read the damn HTTP RFC. I did not read all of it, but most of it. And it is worth it, although it admitedly is boring. I even come back to reading pieces once in a while.
So there is another “shortcut” method to get info from a server using jquery : the “GET” method. Example :
Of course, there is $.post method as well.
Those methods also work as described in the http protocol.
Since HTTP is a REST protocol, I have of course been looking into the other methods : PUT and DELETE.
Surprisingly enough, there is no $.delete nor $.put method.
It looks like one must use the $.ajax and specify the method: to use.