Possible Duplicate:
return from jquery ajax call
jQuery: Return data after ajax call success
        $.ajax({
            url:"list.php",
            dataType: "json",
            success: function(resp){
                for(var i=0;i<resp.length;i++){
                    $('#goods_list').append(
                      "<h3>" + resp[i]["name"] + "</h3>"
                      +
                      "<div>Price: NT$" + resp[i]["price"] + "<br />"
                      +
                      resp[i]["description"]
                      +
                      "<hr /> <a href=# alt='"+ resp[i]["sn"]+ "' class='add_to_cart'>Add</a> | More"
                      +"</div>"
                    );
                }
                var resp2 = resp;
            }
        });
        $('body').append(resp2[0]["price"]);
And FireBug said:
ReferenceError: resp2 is not defined
$('body').append(resp2[0]["price"]);
How can I use $.ajax success data in somewhere else? (outside the $.ajax function)
The concept is similar to "Global Variables".
 
     
    