I am attempting to get a total count of records from a service query. I am having issues with my execution order and understanding things well enough to get what I need. I either get a service fail or a script fail
Within a popup I have script:
saddleCountSearch.execute({ "data" : {"where": '{"maker":"Albion"}'}});
console.log('query attempted'); //this happens
var count=data.length; //this appears to be my fail point
localStorage.setItem("total",count); //this does not happen
console.log('search count-on page'); //this does not happen
then on the data side of things I have on success of saddleCountSearch the following code:
var count2 = data.length;
console.log(count2);
I get a value for count2 which is valid but I get an error for trying to set count on popup. If I comment out the line var count... on the executing popup, the service fails and I obviously have no count2 value.
error when success is true is:
Uncaught ReferenceError: data is not defined
$.die.live.click
jQuery.event.dispatch jquery-1.8.2.js:3063
elemData.handle.eventHandle