XMLHttpRequest
XMLHttpRequest adalah API yang terdapat pada bahasa skrip peramban web seperti JavaScript. Ini digunakan untuk mengirimkan permintaan HTTP atau HTTPS kepada server web dan memuat respon data server kembali ke skrip.[1] Perkembangan versi dari peramban web mayor yang mendukung memungkinkan data dapat dikirim dalam bentuk JSON,[2] XML,[3] HTML, atau teks biasa.
Dukungan
Dukungan di beberapa peramban web:
Dukungan di Internet Explorer versi 5, 5.5, dan 6
Contoh penggunaan sebagai berikut:
if (typeof XMLHttpRequest == "undefined")
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
Dukungan di peramban web lain
Contoh penggunaan sebagai berikut:[4]
function getXMLHttpRequestObject() {
var ref = null;
if (window.XMLHttpRequest) {
ref = new XMLHttpRequest();
} else if (window.ActiveXObject) { // Older IE.
ref = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
return ref;
}
Daftar Pustaka
- ^ "XMLHttpRequest object explained by the W3C Working Draft". W3.org.
- ^ "Response entity body of XMLHttpRequest, W3C Editor's Draft". W3.org. 2012-02-06.
- ^ "The responseXML attribute of the XMLHttpRequest object explained by the W3C Working Draft". W3.org.\
- ^ Using the right version of MSXML in Internet Explorer - Microsoft XML Team's WebLog - Site Home - MSDN Blogs
Pranala luar
Spesifikasi
- XMLHttpRequest (level 1) specification from W3C (abandoned Candidate Recommendation)
- XMLHttpRequest level 2 specification from W3C (Working Draft)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.