Rumah >hujung hadapan web >tutorial js >Bolehkah jQuery AJAX Mengendalikan Muat Naik Fail melalui Kaedah POST?
Soalan:
Adakah mungkin untuk menggunakan yang berikut Kod jQuery untuk melaksanakan muat naik fail menggunakan kaedah POST permintaan AJAX?
type: "POST", timeout: 50000, url: url, data: dataString, success: function (data) { alert('success'); return false; } });``` **Answer:** Previously, file upload was **not** possible through AJAX. However, with the introduction of XHR2, file upload through AJAX is supported using the FormData object. **Clarifications:** * Data part must be filled with an instance of FormData to include file data. * For older browsers without XHR2 support, file upload through AJAX is still not possible. **Support:** Starting from the following desktop browser versions, FormData is supported: * IE 10+ * Firefox 4.0+ * Chrome 7+ * Safari 5+ * Opera 12+
Atas ialah kandungan terperinci Bolehkah jQuery AJAX Mengendalikan Muat Naik Fail melalui Kaedah POST?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!