I'm trying to put together a more complex serialForEach example, which includes "jumping" manually to next step, based on the example in issue #3.
step 1: search for the value
step 2: if found, just go to next step. If not, search again using different parameters, and go to next step using that value
flow.serialForEach(["refe", "lkajdflkjwernm", "crypto", "poidfgmnermn"], function(val) {
console.log("Searching for " + val)
$.ajax({
type: "GET",
url: 'https://api.stackexchange.com/2.1/badges?key=U4DMV*8nvpm3EOpvf69Rxw((&site=stackoverflow&order=desc&sort=rank&filter=default',
data: {inname: val},
success: this
})
},function(search_result) {
console.log('search_result')
console.log(search_result)
var next = this
if (search_result.items.length > 0) {
console.log('found')
next(search_result.items[0])
} else {
console.log('NOT found')
//just get the latest badge
$.ajax({
type: "GET",
url: 'https://api.stackexchange.com/2.1/badges?key=U4DMV*8nvpm3EOpvf69Rxw((&site=stackoverflow&order=desc&sort=rank&filter=default',
data: {},
success: this
})
}
},function(badge) {
console.log('badge')
console.log(badge)
},function() {
console.log('This is the end!');
});
There are multiple issues with this sample:
the 'badge' step isn't called with additional data passed as parameters. 'badge' is always undefined.
processing stops after 2nd value in serialForEach array
Hello,
I'm trying to put together a more complex serialForEach example, which includes "jumping" manually to next step, based on the example in issue #3. step 1: search for the value step 2: if found, just go to next step. If not, search again using different parameters, and go to next step using that value
There are multiple issues with this sample:
How should the code look for this to work?
Thanks