Reply to Re: How to use jQuery ajax instead of XMLHttpRequest

Re: How to use jQuery ajax instead of XMLHttpRequest new!
by colin, 10 years, 8 months ago
I am not too sure which f you are talking about.

The basic JS code for the XHR upload is:
// xhr example
var xhr_file = null;
document.getElementById("xhr_field").onchange = function () {
  xhr_file = this.files[0];
  xhr_parse(xhr_file, "xhr_status");
}
document.getElementById("xhr_upload").onclick = function (e) {
  e.preventDefault();
  xhr_send(xhr_file, "xhr_result");
}

As I said before, if you want to use jQuery, it is more complicated, as you need access the XHR object, which jQuery doesn't publicly allow.

Again, please check the 5 top results here, these links explain how to make it work with a jQuery form, and provide code samples, as well as interesting discussions about different jQuery versions and browser compatibility.Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important