im new to javascript and ajax, i am trying to figure out how to assign to a global variable the retrieved data using ajax. my code looks like this:
$('#store').live('pagecreate',function(event){
var address;
$.ajax({
type: "POST",
url: "testing.php",
data: ({task: 'store'}),
cache: false,
dataType: "text",
success: onSuccess
});
function onSuccess(data)
{
address = data;
}
alert (address);