1. AJAX ??? POST ??? ??
AJAX? ???? ???? GET ??? ??? ??? ?? ??? ???, ???? POST ??? ?? ??? ??? ??? ????. ????? ? ???? ????? ??? ????? ???? ???? ?? ?????. ??? ??? ????? ???? ??? ??? ?? ???? ??? ??? ??? ?????.
?? ??, ???? ? ????? ??? ???? ???? ??? ????? ? ?, ??? ??? ??? ???? ???? ????? ?????? ? ? ?? ????. ??? ? ???? AJAX? ???? ??? POST ??? ???? ???.
2. AJAX ??? POST ??? ??
AJAX? ???? ??? POST ??? ??? ???? XMLHttpRequest ??? ???? ???. ??? AJAX? ???? ??? POST ??? ???? ??? ?????.
var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { // ??? ??? ???? ?? } }; xhttp.open("POST", "http://example.com/api", false); // false? ??? ????? ?? xhttp.setRequestHeader("Content-type", "application/json"); xhttp.send(JSON.stringify({data: "example"}));
?? ???? `xhttp.open()` ???? ? ?? ??? ??? ???? ???? ?? ?????. ?? `true`? ???? ?? ??? ?????? ?????. ??? ??? ??? ??? ??? ??? `false`? ?????.
3. AJAX ??? POST ??? ??
AJAX? ???? ??? POST ??? ???? ?? ??? ????. ?? ??, ??? ???? ???? ??? ? ?, ??? ????? ??????? ????? ???? ???. ?? ?? AJAX ??? POST ??? ???? ??? ?? ???? ???, ???? ??? ??? ? ?? ??? ???? ????? ??? ? ????.
?? ?? ???? ?????? ???? ???? ?? ??? ??? ???? AJAX ??? POST ??? ??? ? ????. ?? ??, ?? ?? ???? ???? ??? ??? ??? ?? ?, ??? ??? ??? ???? ?? ??? ??? ? ??? ?? ? ????.
??
AJAX? ??? POST ??? ? ???????? ??? ??? ?????. ?? ?? ???? ?? ?? ????? ??? ??? ????? ??? ? ????. ??? POST ??? ?? ??? ?? ??, ????? ??? ?? ? ???? ???? ???? ?? ?????. ???? AJAX? ??? POST ??? ???? ??? ??? ????? ? ??????? ??? ??? ???? ? ????.