Monday, 26 August 2013

unable to access jquery data set within ajax success

unable to access jquery data set within ajax success

I have some thing like this:
$.ajax({
type: 'GET',
url: my_url,
success: function(data) {
$('#some_div').data('test', 'This is a test');
}
});
Then outside of the success callback, I tried to access my test variable like
console.debug($('#some_div').data('test'));
But this returns undefined
Any help please
Thank you

No comments:

Post a Comment