How do I SET a Cookie (header) with XMLHttpRequest in JavaScript?

This can be done. You need the following in the $.ajax call: xhrFields: { withCredentials: true } (See the jQuery docs), and you’ll also need the site you’re making the request to to support CORS (they will at least need to allow you origin and also to set the Access-Control-Allow-Credentials HTTP header to true). There’s … Read more

jQuery.post( ) .done( ) and success:

jQuery used to ONLY have the callback functions for success and error and complete. Then, they decided to support promises with the jqXHR object and that’s when they added .done(), .fail(), .always(), etc… in the spirit of the promise API. These new methods serve much the same purpose as the callbacks but in a different … Read more