PANAMA, City, Peregil Edif. Camelias local 5.

how to access variable outside function in javascript


0

Shoddy Way #2: Another option would be to add another parameter to the function which would specify the variable you want to be returned: milkmachine = function (argument, retWhat) { var r; … PS. Accept Solution Reject Solution. Koldo Urrutia. All JavaScript variables must be identified with unique names. This can result in an easy-to-make mistake: attempting to assign the return value of a function to another variable, but accidentally assigning the reference to the function. function ajax_test (str1, callback) { jq.ajax ( { //... your options success: function (data, status, xhr) { callback (data); } }); } Here is my example code for retrieving data from php, and then pass the value to a javascript global variable within ajax success function. Python check if … Python | Using variable outside and inside in JavaScript