Page 2 of 2

Accessing data returned by service on success event

Posted: Wed May 28, 2014 12:20 am
by RobertJay

I can now see a simple alert, but the suggestion by Katya still produces the two screenshots I provided to her. Can someone please help with this!


Accessing data returned by service on success event

Posted: Wed May 28, 2014 12:59 am
by RobertJay

UPDATE: I think I found the problem. Somewhere between the update and rollback a request parameter mapping was lost. I'm going to investigate and will report back here with my findings. My fingers are crossed.


Accessing data returned by service on success event

Posted: Wed May 28, 2014 2:04 am
by RobertJay

FINAL UPDATE: Yes... got it!!! After the rollback became stable, I was able to reconstruct my mappings and access the response data in the success event of my custom function. In case it's of any value to a future reader, the code follows. The main value to me is that when looping thru an array or object or grid and needing to call a service for each element, I'm able to pass values to my function that I can use to know which element the returned data relates to. I'm new at this stuff, and I'm sure better methods exist, but it works for me and just might for someone else. Finally, I can stop kicking my dog out of frustration.

function bobService(v,v2){

get_top10_addresses.execute({
success: function(jqXHR) {
var t1 = jqXHR.results[0].formatted_address;
alert('address for latlon ' + v + ' in iteration ' + v2 + ' is ' + t1);

},
error: function( e ) {
//Error handler here
},
complete: function(jqXHR) {
//Complete handler here
},
});
}


Accessing data returned by service on success event

Posted: Wed May 28, 2014 3:37 am
by RobertJay

It just stopped working... is rollback work still being done that may be the cause?


Accessing data returned by service on success event

Posted: Wed May 28, 2014 3:48 am
by Alena Prykhodko

Hello,

What exactly stop working? Please tell us more details.


Accessing data returned by service on success event

Posted: Wed May 28, 2014 3:50 am
by RobertJay

Thank you. I'm trying to track it down now. It may be a local storage thing. I'll get back to you as soon as I know something more.


Accessing data returned by service on success event

Posted: Wed May 28, 2014 4:05 am
by RobertJay

It was completely my error. All is perfect now. Sorry to trouble you.