soixantecircuits / cropcrop

A tool for cropping video easily online
0 stars 1 forks source link

Normalize AJAX call with new promise method #25

Closed gabrielstuff closed 11 years ago

gabrielstuff commented 11 years ago

This line : https://github.com/soixantecircuits/cropcrop/blob/master/cropcrop/js/upload.js#L41-L50

Should be replaced by :

$.ajax({
  url: "http://fiddle.jshell.net/favicon.png",
  beforeSend: function ( xhr ) {
    xhr.overrideMimeType("text/plain; charset=x-user-defined");
  }
}).done(function ( data ) {
  if( console && console.log ) {
    console.log("Sample of data:", data.slice(0, 100));
  }
});

And you've got plenty room of improvement with all the brand shiny new promise :

http://api.jquery.com/jQuery.ajax/