Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Javascript XMLHttpRequest to jQuery

Can this code be converted to jQuery code? For example by using: jQuery.get(). Although I don't think there is an responsetype arraybuffer.

var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "arraybuffer";
request.onload = function() {
  // do stuff
}

request.send();

EDIT

I'm trying to make a Chrome HTML5 Web Audio plugin for jQuery. So I'm trying to jQuerify where possible. Check out what I try to convert @ http://pieterhordijk.com/sandbox/html5-audio-api/webkit-audiocontext-interface/adding-a-basic-control

Word of caution don't click the play button with the volume high as you can only stop it for now with a refresh of the page :)

like image 678
PeeHaa Avatar asked Mar 18 '26 20:03

PeeHaa


1 Answers

$.get(url, function (data) {
    // do useful things with data
});

Adjust parameters as you like, see jQuery.get().

like image 115
Marcel Korpel Avatar answered Mar 21 '26 08:03

Marcel Korpel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!