How can I return a variable from a $.getJSON function

Posted by Sean Chambers on Stack Overflow See other posts from Stack Overflow or by Sean Chambers
Published on 2008-08-27T20:14:19Z Indexed on 2010/05/25 8:01 UTC
Read the original article Hit count: 225

Filed under:
|
|
|

I want to return StudentId to use elsewhere outside of the scope of the $.getJSON()

j.getJSON(url, data, function(result)
{
    var studentId = result.Something;
});

//use studentId here

I would imagine this has to do with scoping, but it doesn't seem to work the same way c# does

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery