Hi folks,
I have an ajax call that upon success has a variable 'r' that
contains a JSON encoded string. I eval that string and it becomes an
object (an array of structures, etc.), but when I try returning that
object from the function to the caller, something goes wrong. The caller
says that the value returned is undefined.
so...
if(mode == "edit"){
var userObj = getActiveUsers();
// if I dump userObj here...
dump(userObj); // dump shows that userObj is undefined. :o(
}
...
function getActiveUsers(){
var ActiveUsers;
$.ajax({
type: "post",
url: "GetActiveUsers.cfm",
datatype: "html",
data: "",
success: function(r){
r = CFJS.Trim(r);
ActiveUsers = eval("(" + r + ")");
// if I dump the object here (using that very cool dump.js code)
dump(ActiveUsers); // I get exactly what I expect to see --
an array of structures.
},
error: function(){
alert("There was an error retrieving the list of active
users.");
}
});
}
Help! :o(
I'm really confused why this isn't working. I need serious help... asap!
:o( :o(
Chris
--
http://cjordan.info
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/