Results 1 to 5 of 5

Thread: jQuery function return value

Threaded View

  1. #1

    Thread Starter
    Addicted Member *PsyKE1*'s Avatar
    Join Date
    Jun 2010
    Location
    Spain
    Posts
    243

    jQuery function return value

    I am very new to this, I made this function:
    Code:
    function getID(user){
        $.getJSON('https://twitter.com/users/'+user+'.json?callback=?',
        function(data)
        {
            $('#userid').html(data.id_str);
        });
    }
    Works well, but I want that instead of modifying the value of #userid I return a value, I tried this:
    Code:
    function getID(user){
        $.getJSON('https://twitter.com/users/'+user+'.json?callback=?',
        function(data)
        {
            return data.id_str;
        });
    }
    But it makes me return to the function within which it is, not getID.
    Solutions?

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width