Home

Jquery ajax promise

Enter Promises. jQuery have promises implemented with their AJAX methods. In a nutshell, they are utilities that allow us to work with events that have completed or put them in queues or chain them - all of that good stuff. In our case, we need a promise. This allows us to interact with our AJAX requests - well outside our $.get. jQuery Ajax methods return promises themselves, you don't need to wrap them at all. But you can, of course, do it for consistency with the ES6 promise API. UPDATE jQuery 3.0+ implements the Promise/A+ API, so there is no reason anymore to wrap anything in modern jQuery The jqXHR objects returned by $.ajax () as of jQuery 1.5 implement the Promise interface, giving them all the properties, methods, and behavior of a Promise (see Deferred object for more information). These methods take one or more function arguments that are called when the $.ajax () request terminates

The .promise() method returns a dynamically generated Promise that is resolved once all actions of a certain type bound to the collection, queued or not, have ended.. By default, type is fx, which means the returned Promise is resolved when all animations of the selected elements have completed. Resolve context and sole argument is the collection onto which .promise() has been called Type: Deferred or Promise or Thenable. Zero or more Thenable objects. If no arguments are passed to jQuery.when (), it will return a resolved Promise. If a single Deferred is passed to jQuery.when (), its Promise object (a subset of the Deferred methods) is returned by the method. Additional methods of the Promise object can be called to attach. jquery ajax post example; jquery ajax $.post with data; js add delay with promises; ajax calls; js promis with ajax; nodejs promise then example; get promise result from json() javascript; promise catch; jquery wait for all ajax requests to complete; jquery ajax post; make ajax request post jquery; return new Promise(res => {jquery ajax promise. Every Ajax method of jQuery already returns a promise. When the Ajax call in function A completes, it resolves the promise. The function B() is then called with the results of the Ajax call as its first argument. When the ajax call in B() completes, it resolves the promise and function C() is called with the results of that call and so on. Here we are just addin

Working with jQuery's AJAX, Promises and Deferred objects

Use of Callback & Promise with and without jquery; Promise is the right way to deal with async activity. Its clean and very flexible. It makes your application maintainable and you can extend the. Using promises to merge async jQuery Ajax calls. September 12, 2013. When we use jQuery to call a service it will, by default, process the call asynchronously. This is preferred behavior. We wouldn't want our UI thread waiting for a long-running task. But, this implies that the return value of such an Ajax call -or variables defined inside the.

javascript - jQuery ajax with ES6 Promises - Stack Overflo

  1. version added: 1.12-and-2.2 jQuery.get ( [settings ] ) settings. Type: PlainObject. A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with $.ajaxSetup (). See jQuery.ajax ( settings ) for a complete list of all settings. The type option will automatically be.
  2. Sequential AJAX and jQuery's promise. As the name suggests, A synchronous J avascript A nd X ML, AJAX is asynchronous. Usually you don't care when a call completes as long as the callback is invoked upon completion. This style of AJAX is common and a plethora of examples exist on the internet
  3. Promises Implemented jQuery.ajax() (v 2.0.3) The good news is that you don't have to worry about implementing the Promise Pattern from scratch. The Promise Pattern is fully baked into the jQuery Ajax method and it's that implementation that will be used in this article. For the examples that follow, assume that the following code snippet is used: $.ajax({url: mywebservice.com}) For.
  4. Promise can be used to bind callback conditionaly. When I want to do conditional functionality after a ajax call, If I am using an options I want to do condition checking inside the callback where as when using .done or .fail method I can bind the callback conditionaly. var jqXhr = $.ajax( { url: /someurl, method: GET, data: { a: a }); if.
  5. You might have worked with Promises before (perhaps jQuery Promises), but in SPFX the Promises Framework used is ES6 Promises - so it's a good idea for your methods to return this type of promise rather than a jQueryPromise. We also have to deal with this in TypeScript, so in short there are a few changes to what you might have done before. You most likely used jQuery's AJAX methods to.
Simple Flexible Loading Overlay Plugin With jQuery

Promise 解决 jquery ajax 验证回调嵌套的问题 Tinybic. 11-30 494 作为前端,需要经常验证用户输入和表单提交,一般像验证姓名,手机号,邮箱,身份证号等都在前端用正则匹配来验证就够了,传到后台以后后台可以再验证一次,但是最近项目要求统一调用后台接口进行验证。那么问题来了,如果只是在前. JS AJAX AJAX Intro AJAX JS vs jQuery jQuery Selectors jQuery HTML jQuery CSS jQuery DOM JS Examples JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Certificate JS References JavaScript Objects HTML DOM Objects. JavaScript Promises Previous Next I Promise a Result! Producing code is code that can take some time Consuming.

How can i wrap jquery ajax call in async and await function with promise usage [Answered] RSS. 8 replies Last post Oct 11, 2020 03:47 jquery predates javascripts definition of promises. jQuery had deferred, which was a promise like utility probably influenced by dojo's deferred. When promises become popular, jQueries differed was modified to also be promise compliant. JavaScript promises. 在封装AJAX前,在我前面封装的jQuery(看我的实现一个jquery api)下进行封装;. 对于jQuery这里只是借用这个函数的对象返回值,所以我就简单一写 I recently discovered a better way of handling callbacks in jQuery. Even though this has been available for years, I was stuck in my hold ways. I hope this v..

jQuery Ajax Methoden Versprechen verspricht sich, Sie nicht brauchen, um sie überhaupt zu wickeln. Sie können dies jedoch aus Gründen der Konsistenz mit der ES6-Verspre- chen-API tun. UPDATE jQuery 3.0+ implementiert the Promise/A+ API, es gibt also keinen Grund mehr, etwas i Introduction to jQuery promise. The jQuery promise() is one of the default methods it is used to return the unwanted or not confirmed objects whether it is in a static or dynamic type but which has been already performed some user events, actions, and other operations that can be resolved in all the parts like collections, stacks, queues, etc but default some arguments should be passed in the. ..will give you a promise that will wait not only for the ajax call, but also for the promise returned by the done callback. This is a major part of the power of promises. The reason for the weird $.when syntax is that $.when expects to receive individual promise arguments and wait for them all; it doesn't accept an array

jQuery deferred.promise() 方法 jQuery 杂项方法 实例 设定两个延时时间是随机的定时器,分别用于解决(resolve)和拒绝(reject)延迟对象 [mycode3 type='javascript'] $(function { function asyncEvent(){ var dfd = new jQuery.Deferred(); // 在一个随机的. Promise. Until jQuery 1.5, a typical $.ajax() call looked like this: $. ajax ({url: /myServerScript, success: mySuccessFunction, error: myErrorFunction }); The $.ajax() call returns a jQuery XMLHttpRequest object. Nothing new so far. Since version 1.5, the returned object implements the CommonJS Promises/A interface. That's a mouth full. CommonJS is a initiative to define common and. Normally, only the creator of a Deferred should call this method; you can prevent other code from changing the Deferred's state by returning a restricted Promise object through deferred.promise().. When the Deferred is rejected, any failCallbacks added by deferred.then() or deferred.fail() are called. Callbacks are executed in the order they were added For more information regarding jQuery promises have a look at: including the fact that the if statement checking call values are in no way synchronized with the ajax return values. Thanks for the heads up regarding the lack of closing curly braces, that has been fixed. Reply. Cancel reply. Comment . Name * Email * Save my name, email, and website in this browser for the next time I comment.

jQuery.ajax() jQuery API Documentatio

Learn jQuery - Asynchronous Promises Chaining. Example. If you have multiple asynchronous tasks that needs to occur one after the other, you will need to chain together their promise objects ajax() 方法通过 HTTP 请求加载远程数据。该方法是 jQuery 底层 AJAX 实现。简单易用的高层实现见 $.get, $.post 等。$.ajax() 返回其创建的 XMLHttpRequest 对象。ajax 绝对是 jQuery库中最重要的方法,大大的简化了ajax请求的编码过程,使用方式优美。如果说不足之处就是当许多功能需要连续调用,环环相扣依赖时.

Ajax jquery không còn lạ gì với anh em developers nữa, những có nhiều thứ tôi nghĩ sẽ có nhiều bạn còn chưa biết và chưa sử dụng bao giờ như sử dụng ajax with Promises and deferred objects? Làm thể nào gọi Multiple AJAX một cách tốt nhất? Thì trong bài viết này sẽ giới thiệu sâu và kỹ hơn về ajax As we know that each jQuery.ajax() will return a deferred object, we can return a list of such deferred objects as an argument to jQuery.when.apply() as shown below. Now the solution looks more clean, readable, maintainable and a re-usable one. Conclusion. Promises allow you to avoid nasty tricks to synchronize parallel or sequential asynchronous functions and the need to nest callbacks inside. This breaks the jQuery AJAX load -function ( $ (element).load (someURL) ), since jQuery 2.2.0 and 3.0.0 (see jquery/jquery@ 97ef1f2 ), as the .always () function is used instead of the deprecated .complete (). This can be fixed by adding the line promise.always = promise.complete; between lines 20 and 21. This comment has been minimized

jquery的ajax返回一个受限的Deferred对象,还记得受限的Deferred对象吧,也就是没有resolve方法和reject方法,不能从外部改变状态。想想也是,你发一个ajax请求,别人从其他地方给你取消掉了,也是受不了的 .ajax().fail(function(jqXHR, textStatus, errorThrown){}); Replaces method .error() which was deprecated in jQuery 1.8.This is an alternative construct for the complete callback function above. Example

Demonstrating Promises, Async, Await in Javascript - Web

A Promise object can be treated as a Deferred object which state cannot be manually changed. The jQuery ajax function returns a jqXHR object. There are two important facts about this jqXHR object. First, a jqXHR object is a superset of XMLHTTPRequest object. For example, a jqXHR object can query the state of the XMLHTTPRequest by referring its readyState property. If its readyState is 4, the. jquery的ajax返回的是promise对象吗? 是的,但是在jQuery中,不仅只有Ajax函数(.ajax,.get, .post)可以返回Promise对象,动画函数也可以返回Promise对象 老旧的浏览器没有promise对象怎么办 我们可以使用es6-promise-polyfill。es6-promise-polyfill可以使用页面标签直接引入,可以 通过es6的import方法引入(如果你是用. Since version 1.5.1, jqXHR objects returned by $.ajax () implement a Promise interface. In short, this means that a number of methods that are exposed provide powerful abstraction for handling multiple asynchronous tasks. I think it is important to note that the subject of the jQuery Deferred and Promise Objects is deep doTheThing() .then((data) => { console.log(data) doSomethingElse() }) .catch((error) => { console.log(error) }

Video: .promise() jQuery API Documentatio

jQuery.when() jQuery API Documentatio

Jquery post with promises - code example - GrabThisCode

  1. g for the web using.
  2. Ich versuche, eine Post-Anfrage über jQuery mit einem ES6-Versprechen zu stellen: Ich habe eine Funktion: getPostPromise (etwas, etwas anderes) {neues Versprechen zurückgeben (Funktion (auflösen, ablehnen) {$ .ajax ({..
  3. jquery ajax promise Code Answer's. jquery post with promises . javascript by Disturbed Deer on Jul 18 2020 Comment . 0 Source: stackoverflow.com. javascript promise with ajax . javascript by Bewildered Booby on Dec 09 2020 Comment . 0. Source: www.
  4. jquery 의 $.ajax 에 Promise 패턴 이용하기 . ajax 는 말그대로, 비동기 통신을 하기 위한, 도구이다. jquery 에서는 $.ajax 또는 jQuery.ajax 라는 메서드를 통해서, 쉽게 ajax 를 이용할 수 있다. 내부적으로는 XMLHttpRequest 를 이용하고 있으며, 여러가지 편의 기능, option 을 제공하고 있다. 이중에서도, 매번 ajax 로.
  5. Using the jQuery Promise Interface to Avoid the AJAX Pyramid of Doom Using jQuery Deferred to Manage Multiple AJAX calls What Are the Top 10 JavaScript Links for AJAX ? [] November 18, 2017 at 7:57 am Comments are closed. 10% discount! - Use code KEVIN10. Subscribe to this blog. Receive email notifications about new posts. Leave This Blank: Leave This Blank Too: Do Not Change This: Your.
  6. g.
  7. Even more interestingly, you can push one deferred's promise interface onto any other object by calling the promise method with an object as its argument. This is exactly what jQuery does internally when it sets up the jqXHR object. $.ajax endows jqXHR with the promise interface to its internal deferred simply by calling deferred.promise(jqXHR)
¿De qué forma realizar un keyword research? - Aprender

在需要依赖完成的ajax请求可使用promise保证执行顺序 在第一个请求正确返回后再发送第二个请求 原生js写ajaxpromise对 Now that .always(), .done() and .fail() are the preferred methods for implementing callbacks from a jQuery.ajax() invocation, and the old methods have been deprecated, it might be a good time to explain the arguments accessible by each of the new methods, and additionally the .then() and .pipe() when applied to jQuery.ajax() invocations

Chain AJAX Requests with jQuery Deferred DotNetCurr

  1. Deferreds are used behind the hood in Ajax but it doesn't mean they can't also be used elsewhere. This section describes situations where deferreds will help abstract away asynchronous behavior and decouple our code. link Caching link Asynchronous cache. When it comes to asynchronous tasks, caching can be a bit demanding since you have to make sure a task is only performed once for a given key.
  2. At the heart of jQuery's implementation is jQuery.Deferred — a chainable constructor which is able to create new deferred objects that can check for the existence of a promise to establish whether the object can be observed. It can also invoke callback queues and pass on the success of synchronous and asynchronous functions. It's quite essential to note that the default state of any Deferred.
  3. 爆速でわかるjQuery.Deferred超入門. Yahoo!デベロッパーネットワークの中野 (@Hiraku)です。. これまで、JavaScriptで非同期処理を書く上での問題として、 コールバック地獄 や エラー処理に例外が使えない ことなどを解説してきました。. これらの問題に対処する.
  4. jQuery uses deferred objects and promises internally in some of its APIs. For instance, when you call the $.ajax() function it returns a jqXHR object. Among the functions available on the jqXHR object are the three promise functions, done() , fail() and always()
  5. jQuery Promise es uno de los conceptos que cuesta más entender cuanto de trabajamos con Ajax. Sin embargo sino entendemos este concepto será muy difícil desarrollar aplicaciones Ajax que sean flexibles y reutilizables.Vamos a mostrar un ejemplo que nos ayude a entender mejor las cosas
  6. When the Deferred is resolved or rejected, usually by the code that created the Deferred originally, the appropriate callbacks will be called. For example, the jqXHR object returned by jQuery.ajax() is a Promise-compatible object and can be used this way

Ajax — Async, Callback & Promise

JavaScriptのPromiseとjQueryのPromise. JavaScript jQuery. はじめに . JavaScriptを同期的に処理させたい! これはちょっと複雑なスクリプトを組むと出てくる要望であり、来たるコールバック地獄への入り口でもあります。 しかし幸いな事にJavaScriptにはこれを解決させる手段としてPromiseが用意されています. 今回は、Ajax、Deferred機能などを中心に紹介しましょう。 また、先日7月7日に、jQuery 3.1.0がリリースされましたので、そちらの変更点も併せてお伝えします。 対象読者. Webアプリケーション開発に興味があり、jQueryを知っている方 Deferred機能 $.Deferredは、jQuery 1.5から導入された非同期処理のための. For example, we cannot consistently call Promise callbacks asynchronously if $.ajax supports Promises with async: false. We *would* like to collect some real-world uses of sync ajax. Please post some links to your code, so we can understand the use cases we need to address. My working assumption is that sync ajax requests are very simple and don't require things like prefilters or non-XHR. link Promises. In its most basic form, a promise is a model that provides a solution for the concept of deferred (or future) results in software engineering. The main idea behind it is something we've already covered: rather than executing a call which may result in blocking, we instead return a promise for a future value that will eventually be satisfied. If it helps to have an example here. 少しjQueryのajaxの書き方をお勉強しましたのでまとめます。 Deferredオブジェクトを使うことによって シーケンシャルな非同期処理の実装が可能になります。 Deferred // 関数定義 function ajaxWithAppendToBody (ajaxOptions){var deferred = new $. Deferred; $. ajax (ajaxOptions). done (function (data){$ (data). appendTo ( body ); // ajax.

Ajax without jQuery - JavaScript - Ibrahim Diallo › On roundup of the best education on www.idiallo.com Education Aug 02, 2015 · But writing code that works everywhere is not so hard anymore. So today, let's try to understand how Ajax works in vanilla JS.Without jQuery, well there are a few things to be aware off before starting. The XMLHttpRequest Object Get code examples likejquery ajax promise. Write more code and save time using our ready-made code examples. Get code examples likejquery ajax promise. Write more code and save time using our ready-made code examples. Search snippets; Browse Code Answers; FAQ; Usage docs; Log In Sign Up. Home; Javascript ; jquery ajax promise; Alan Rat. Programming language:Javascript. 2021-04-20 19:50:37.

Using promises to merge async jQuery Ajax call

Ajax Admin Plugin For WordPress - WPTime

jQuery.get() jQuery API Documentatio

jQuery Ajax. The basic syntax of jQuery Ajax is: 1. $.ajax([settings]) There are tens of settings you can use for the function. But usually we are interested in the url. The new syntax of jQuery ajax recommends everyone to use Promises. Which gives the function multiple callback options, like done and fail. 1 For this example, I'm using the jQuery asynchronous ajax method to retrieve a Customer object from a Web Service (using the ajax method means I need to use NuGet to add the DefinitelyTyped file for jQuery to my project). In the ajax method's success method I provide an arrow expression that the ajax method will call when the Customer object is retrieved successfully. The ajax method will pass. 由于p1执行较快,Promise的then()将获得结果'P1'。p2仍在继续执行,但执行结果将被丢弃。 如果我们组合使用Promise,就可以把很多异步任务以并行和串行的方式组合起来执行。 jQuery ajax. jQuery在全局对象jQuery(也就是$)绑定了ajax()函数,可以处理AJAX请求

Simple Image Viewer with jQuery and Bootstrap - imageboxERITIA (Cadiz) - 2021 All You Need to Know Before You GoBuchanan Cars for sale

Sequential AJAX and jQuery's promise - monkey code

The SEO Cyborg: How to Resonate with Users & Make Sense to

The Simplest Thing Possible: Promises in JavaScrip

In this article I'll show how to use promises to cache AJAX requests in a clean and elegant way. First, let's make a good 'ol AJAX call using jQuery to retrieve information from a song. // Load a song information $.post ('/songs', { id: 1 }, function (response) { console.log (response); }); So far, so good, now imagine I make several. Get code examples like how to use jquery promise then instantly right from your google search results with the Grepper Chrome Extension //实际的异步方法还是原先那个,只不过Promise对象把这个异步过程分为了resolve和reject 2种状态。 posted @ 2018-06-11 14:59 惊沙男孩 阅读( 3110 ) 评论( 0 ) 编辑 收藏 举

JQuery : Why I prefer $

jquery deferred ajax ruft die Ausführung auf - javascript, jquery, ajax, promise, jquery-deferred. Ich versuche, zur Laufzeit mehrere Skripts mit Jquery zu laden, und dann ein Ereignis auszulösen, sobald sie geladen sind. Der Code muss mit einer beliebigen Anzahl von Skripts umgehen, also benutze ich $.when.apply Das Problem ist, dass das Ereignis nicht zur richtigen Zeit ausgelöst wird. JQuery ajax Promise example. jQuery have promises implemented with their AJAX methods. In a nutshell, they are utilities that allow us to work with events that have completed or put them in queues or chain them - all of that good stuff. In our case, we need a promise . This allows us to interact with our AJAX requests - well outside our $.get utility. The jqXHR objects returned by.

Chris O'Brien: Dealing with async REST API calls in the

However jQuery Promises in the upcoming version 3.x will be compatible with the Promises/A+ specification (thanks to Benjamin Gruenbaum for pointing it out). Currently (as of May, 2015) the stable versions of jQuery are 1.x and 2.x. What I explained above (in March, 2011) is a way to use jQuery Deferred Objects to do something asynchronously that in synchronous code would be achieved by. jquery ajax promise . javascript by Ajay on Sep 08 2020 Donate -1 Source: blog.revathskumar.com. Javascript answers related to ajax promise like interface jqeury.sub $.ajax({ajax comet; ajax common; ajax stand for; ajax vs rest; ajax.complete(handler) example jquery; all ajaxcomplete event; finally in ajax call. GitHub - Gerhut/jAjax: jQuery.ajax with Promise in ES6 (Polyfill included). Use Git or checkout with SVN using the web URL. Work fast with our official CLI. Learn more . If nothing happens, download GitHub Desktop and try again. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again Die von $ zurückgegebenen jqXHR-Objekte.ajax implementiert die Promise-Schnittstelle und gibt ihnen alle Eigenschaften, Methoden und Verhalten einer Promise. Diese Methoden benötigen ein oder mehrere Funktionsargumente, die aufgerufen werden, wenn die Anforderung $ .ajax beendet wird. Auf diese Weise können Sie mehrere Rückrufe für eine einzelne Anforderung zuweisen und sogar Rückrufe.

jQuery使用promise处理ajax_Liyin233的博客-CSDN博

jQuery Ajax-Methoden geben Versprechen selbst zurück, Sie nicht brauchen sie überhaupt zu wickeln. Sie können dies jedoch natürlich tun, um die Konsistenz mit der ES6-Versprechen-API zu gewährleisten. AKTUALISIEREN jQuery 3.0+ implementiert die Promise / A + -API, sodass es keinen Grund mehr gibt, etwas in modernes jQuery zu verpacken. For the most part, I'm pretty familiar with promises and how they work, and have used them on a few projects. I'm having a little trouble with getting all my promises to finish in making several calls for different calendar data from the Google Calendar API and for the script to calculate the length of the resulting array to use in callback functions. Here is the relevant code Hilfe bei der Programmierung, Antworten auf Fragen / Jquery / Eine Reihe von Versprechungen aus RSVP.js mit jQueries $ .ajax integrieren - jquery, ajax, ember.js, promise, rsvp.j In Ajax functions many callback functions exist. For example, when the request is raised, one function will raise one event when the request is successfully finished, again another function will be fired. Success function. This is the most important and heavily used functions of jQuery Ajax functions 使用标准 Promise (with polyfill) 封装 jQuery.ajax 返回的 Deferred. 整个打了一个包,发到了 GitHub 上. 叫 jAjax. 连带打包工具、Promise Polyfill 都放到上面了. 如果需要低版本的 jQuery.ajax. 或者更快的 Promise 实现. 可以把仓库克隆下来. 自作主张. 如果就想擎现成的

JavaScript Promises - W3School

jquery中,还有一个$.when方法来实现Promise,与ES6中的all方法功能一样,并行执行异步操作,在所有的异步操作执行完后才执行回调函数。不过$.when并没有定义在$.Deferred中,看名字就知道,$.when,它是一个单独的方法。与ES6的all的参数稍有区别,它接受的并不是数组,而是多个Deferred对象,如下 In this course, Interacting with Data Using jQuery and Ajax, you'll learn to make Ajax calls using jQuery. First, you'll explore the history of Ajax with the JavaScript language. Next, you'll discover how to use Promises and jQuery to retrieve and submit data via a Web API server. Finally, you'll learn how to build an HTML form and. 6 Different ways to do Ajax calls in JavaScript. There are so many options in different ways to call Ajax in JavaScript that can improve user experiences drastically like submitting data to the. Creating Responsive Applications Using jQuery Deferred and Promises; @tokkonoPapaさんによる上記事の翻訳はこちら → jQueryのDeferredとPromiseで応答性の良いアプリをー基本編; 論より実践。deferredをうまく使ったAjaxコードを見てみましょう。 jsfiddleでの実例はこち

使用标准 Promise (with polyfill) 封装 jQuery.ajax 返回的 Deferred. 整个打了一个包,发到了 GitHub 上 . 叫 jAjax. 连带打包工具、Promise Polyfill 都放到上面了. 如果需要低版本的 jQuery.ajax. 或者更快的 Promise 实现. 可以把仓库克隆下来. 自作主张. 如果就想擎现成的 $ npm install jajax $ bower install jajax 都行. 此外. jQuery. Using the jQuery Promise Interface to Avoid the AJAX Pyramid of Doom Using jQuery Deferred to Manage Multiple AJAX calls What Are the Top 10 JavaScript Links for AJAX [] November 18, 2017 at 7:58 am Comments are closed. 10% discount! - Use code KEVIN10. Subscribe to this blog. Receive email notifications about new posts. Leave This Blank: Leave This Blank Too: Do Not Change This: Your email. Compare npm package download statistics over time: ajax vs fetch vs jquery vs node-fetch vs request-promise vs superagent vs undic