Thursday 15 April 2010

jquery - return multiple value from function back to call -


I'm a noob ... and I'm sure what I'm trying to ask (better terminology) callback ?) But basically I want to know how to get calcuted values ​​in a function from which the function was called eg:

  $ (function () { SetValues ​​(); console.log (val1, val2, val3);}); Function set value () {var val1 = 10; Var Val 2 = 20; Var Val 3 = 30; }  

Try something like this:

  $ (Function () {var myvalues ​​= setValues ​​(); // stores the values ​​derived from these functions / you can now get some first value such as console log (myvalues.value1)}) ; Function set value () {var val1 = 10; Var Val 2 = 20; Var Val 3 = 30; Returns {value1: val1, value2: val2, value3: val3} // This data sends back the original location, where you called the function}  

I would suggest reading


No comments:

Post a Comment