javascript - Return AJAX data before iterating parent loop -


Sorry guys and girls, this is not able to wrap my head around this one, I read various online situations in spite of . So here's the situation:

I have found an array of strings that the recipient list

for each string in that array, Want to create AJAX call which passes string as a parameter, then returns data from AJAX for my callback function.

What is happening below my code is that if I have three strings in the recipient list array, my expansion distribution list function 3 times It is called, but this code never hits the successful part of the AJAX call until my Consideration:

  Function Extended Distribution List (Email Address, CB) {$. Data: {DistListName: emailAddress,}, Success: Function (Data) {cb (data): Ajax ({url: "extension / distribution list", type: 'get', datatype: 'jason', reference: data, ;}, Error: Work () {ace.search.mainframeErrorSignal = $ .signal ({'message': 'Unable to expand distribution list.', 'AddClass': 'error', 'sticky': true}) ;}}); } Recipients list (object) (expanded distribution list (item, work (data) {if (data ...) {// some code is here} other {// do something else}})}};  

Hmm, I'm not sure, but it works with my code

< Pre> function sendAsJSON (url, data, async, success callback, error breakback) {$ .ajax ({url: url, data: data, type: "post", async: true, data type: "json" ContentType: "application / json; charset = utf-8", success: function (data) {if (success callback A; =;) {successClallback (data.d);}}, error: function (error data) {if (errorCallback! = Zero) {errorCallback ();}}})} < P> Will you mind turning the "GET" into "post" and add content type.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -