I know how to access data loaded with jQuery.get() via the function() like this:
jQuery.get("somefile.php", function(data, status){
alert("Data:" + data + "nStatus:" + status);
});
But is there a way how to access the result without the function()
part, but directly?
Like let’s say, I would have something like this:
var _result = jQuery.get("somefile.php");
alert(_result);
The alert window shows there is [object Object], so I guess it might be some kind of an associative array, right?
Now the question is: how to access its data this way – is it even possible?
I tried to access it like “normal” array by calling _result[0]
and also tried _result[1]
, but it looks that is not the way, thus I thought maybe it is an associative one? But then what are the correct words? I tried _result["data"]
and _result["result"]
, but that did not work, obviously.
Does anyone know what is the correct way…if possible at all?