showing results for - "js promis with ajax"
Clara
02 Jul 2016
1function doTheThing() {
2  return new Promise((resolve, reject) => {
3    $.ajax({
4      url: window.location.href,
5      type: 'POST',
6      data: {
7        key: 'value',
8      },
9      success: function (data) {
10        resolve(data)
11      },
12      error: function (error) {
13        reject(error)
14      },
15    })
16  })
17}
Oskar
12 Mar 2020
1doTheThing()
2  .then((data) => {
3    console.log(data)
4    doSomethingElse()
5  })
6  .catch((error) => {
7    console.log(error)
8  })
Diego
24 Jul 2019
1function doTheThing() {
2  $.ajax({
3    url: window.location.href,
4    type: 'POST',
5    data: {
6      key: 'value',
7    },
8    success: function (data) {
9      console.log(data)
10    },
11    error: function (error) {
12      console.log(error)
13    },
14  })
15}
queries leading to this page
javascript promise with ajax callajax call with promisesjavascript promis ajaxare js promises ajaxajax promisreturn ajax promise jqueryreturn a promise to ajax callpromise jwaquery ajaxjquery promises ajaxawait javascript promise ajaxajax with promisespromise ajax calldoes ajax support promiseuse ajax call inside promise functionpromises in ajax jqueryjquery ajax call with promisejquery return ajax promisewhat does an ajax promise request to jqueryjavascript promise with ajaxjquery ajax with promisewhat is a promise ajax thenjavascript does ajax return a promisejs promis with ajaxjavascript promise ajax requestjavascript promise jquery ajaxajax call promise jswhat is a promise ajaxreturn ajax data in promiseajax promise javascriptpromise 2b jquery ajaxjavascript ajax with promisejs promise ajaxajax response promisshould you do ajax inside a promisepromise then method in ajaxjavascript ajax promise example with function callajax vs promisepromises javascript ajaxajax with promiseajax promise handlingvanilla javascript ajax promiseajax is a promiseajax with promijquery promise ajax thenajax using promisespromise 3d ajax jshow to make promise in ajaxjavascript ajax promiseajax done promisereturn new promise ajax callpromise ajaxdoes ajax uses promisehow to get data from ajax promiseajax promise exampleajax promise jqueryhow to use promise in ajax callajax get with promisejs promise with ajaxpromise ajax requestjquery ajax promisespromise in jquery ajaxjquery ajax promise examplecall ajax on promise thenpromises ajaxpromise example with ajax request jqueryajax promises with jqueryjquery ajax promisepromise with ajax jqueryajax call as promisereturn promise example ajaxpromise based jquery ajaxpromise from jquery ajaxhow to use promise in jquery ajax callpromise javascript ajaxwrap ajax call in promisejavascript promise pure ajax callajax jquery promiseajax call promisejquery return promise from ajaxpromise with ajaxhow to use promise with 24 ajax jquerypromise jquery ajaxjquery ajax wit promisesjquery promise ajax exampleusing promise and ajax call ajax call using promisejavascript promise ajaxajax with promise thenjquery ajax turn to promiseajax promis andajax promisepromises ajax javascriptpromise in ajax javascriptjs ajax call promisejquery promise ajaxajax and ajax promise 27use promise in ajax requestajax promisesjavascript ajax call promisepromise in ajax responsedone promis ajax jqueryajax promises returnpromises in ajaxjquery promises ajax donejquery ajax call promisehow to use promise to return data from ajax callis ajax a promisejavascript promise ajax calla ajax promesereact promise going into rejected without making ajax request calljs promis with ajax