A possible (but not the most efficient) solution would be something
like this:
function getAllWhatever() {
var result = this.getAllRecords();
var record = new Array();
var test = 13;
alert(test);
while(result.isValidRow()) {
record = someN
The first example ricardo gave you is not ok. Use the second example.
Because "http://test.url/?callback=?";, gets called, but javascript
doesn't wait to get a response from that request (the first A from
AJAX is from Asynchronous!). It goes forward and calls it again and
again and again quickly w
For example:
function someName() {
var result = this.getAllRecords();
var data = new Array();
var test = 13;
alert(test);
while(result.isValidRow()) {
$.getJSON("http://test.url/?callback=?";,
{
TABLE_NAME:'BARCODE_CODES',
RECORD_ID: res
The second option - calling another function from the callback - is really
the way to go. Otherwise you don't know when the data is ready. By calling
the other function from the callback, you can ensure that the data is
actually present.
-Mike
> From: ricardobeat
>
> just declare the variable
just declare the variable outside the callback, in the scope where you
need it, for example:
$('something').click(function(){
var message; //the var 'message' will be available inside this
function, and can be set by any inner function
$.getJSON('http://...', function(data){
me
5 matches
Mail list logo