1,144 questions
0 votes
1 answer
101 views
Explain why the order of operations is different between jQuery 2.2.4 and jQuery 3.7.1
Given three files: view.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport"...
1 vote
1 answer
61 views
Call multiple ajax and take only success result using jquery
I have 1 html (2cols, 6rows) and 12 ajaxs. Each ajax's result will be binding to its own (regardless of success or failure). Ajax will return 200 or 403. don't know at this time. ※IMPORTANT※ All ...
0 votes
1 answer
73 views
Chaining jQuery.Deferred
I have got two JS functions, both return jQuery's promise. Let's say they are: getServerTimestamp() and, say, doSomething(). getServerTimestamp(), on its first call, basically gets the current time ...
-1 votes
1 answer
82 views
Issue with Native promise resolve outside the function
I am trying to refactor jQuery promises with native promise for the below codes. public functionA(){ const dArray = Array<JQueryDeferred<{a:string}>>=[]; //other lines of logic ...
0 votes
1 answer
127 views
caching using jquery deferred versus promise
I currently have some code using jQuery Deferred and ajax to call remote api and get the data and put in localStorage and get data from localStorage. This code seems buggy the first time it runs (i.e. ...
0 votes
1 answer
294 views
How to properly use jQuery Deferred inside of a loop
I'm trrying to call a function that loops through a dataset and updates values in that dataset from data that comes from an asynchronous function. I obviously need to know when that function completes ...
0 votes
1 answer
387 views
Using Typescript promise instead of jQuery deferred
I am having the below lines of code which is using JQueryDeferred object from the type definition class jquery.d.ts. Trying to replace jQuery deferred to typescript promise. Existing JQueryDeferred ...
0 votes
1 answer
111 views
How to extract a value from a promise when called synchronously using Javascript `await`?
I'm working on a project that uses a custom user prompt using jQuery / jQuery UI: function dialog_confirm(dialog_body, dialog_title = 'Confirm') { var def = $.Deferred(); $('<div></div&...
0 votes
2 answers
174 views
How do I delete a callback deferred.progress?
How do I delete a previously assigned handler? var deferred = $.Deferred(); var callback = function(n) { console.log('Test ' +n); } deferred.progress(callback); deferred.notify(1); $(...
0 votes
1 answer
151 views
Ajax request made but position of value in returned response as array keeps changing. how do I fix this
I have a script which sends an array of numbers via Ajax to a web server. The values are used to query a database and then the corresponding values of those numbers In the table are sent back which I ...
0 votes
0 answers
27 views
How do I use $.when() instead of await in the following function?
I have the following 2 functions: $(document).on(`dragover drop change`, `.fileUpload`, async function(e) { e.stopPropagation(); e.preventDefault(); const thisEl = $(this); if (thisEl....
0 votes
0 answers
42 views
Chaining jQuery promises
I wish to call dealCardSelectableAI(), have it chooseCards(), then use the output to set an observable system.star.cardList(), then call setCardName(). Once all this is done I want saveGame() to ...
0 votes
1 answer
104 views
Function returning before jQuery promise within promise is resolved
I have a function which calls dealCardSelectableAI(), which sets up a number of jQuery deferred promises. The function setCardName() is then called from within it. Once both functions complete their ...
0 votes
0 answers
23 views
Is $.when() or $.when.apply() the correct call for getting a promise out of a forEach?
I have a function processing an array, calling a function for each entry within the array with a Promise returned, and then finally returning that it's done. var dealCardSelectableAI = function () { ...
0 votes
2 answers
95 views
What is the difference in jQuery between returning deferred and deferred.promise()?
I'm working in an ES5 environment using jQuery. I have some code as follows: var saveGame = function (gameState, saveStars) { var deferred = $.Deferred(); var starsSaved = saveStars ? false : true;...