Message from JavaScript discussions

February 2017

— Returns a new promise that only resolves when a list of promises given to it resolve

— 

So I can run the ajax, generate promises for the multiple requests, give them to Promise.all() and run my endgame code in then() on the final promise

— Hii guys. I like to large video uploading . But iam not uploading videos . Can any help me out by using jquery

Thanks in advance

Message permanent page

— For large file upload via XHR is recomendable to use chunked file upload. Here is a JQuery plugin that supports that: https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads

Message permanent page

— +1

— Tiny baby ajax

function ajax (url = "/", resType = 'text') {
return new Promise (function (resolve, reject) {
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState === 4) {
if (req.status >= 400 && req.status < 600) {
reject("HTTP Error " + req.status + ": " + req.statusText);
} else if (req.status >= 200 && req.status < 400) {
resolve(req.response);
}
}
};
req.open("GET", url);
req.responseType = resType;
req.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
req.send();
});
}

Message permanent page

— 

ajax("/url", "json").then(function (response) {

  console.log(response.prop);

});

— +1. But this condition && req.status < 600, is really necesary?

— Just seem too paranoid, but I think it's ok 😂

— Heh

— Designers Hub - UI/UX
Community to share queries, post tips, latest trends and tricks relating to UI/UX design development. Articles from across groups into one repository... Lets Go Design how2design
https://t.me/how2design

Message permanent page

— Other Admins, DO NOT delete this! Yes it is spam (because no one requested and is almost not related to js) but Fazal is the admin of this group. So let's allow this post this time.

Message permanent page