I am getting data from an AJAX source and then assigning it to a global variable which doesn't seem to be working. Can someone please point me into the right direction?
var products = [];
var count = 0;
$.ajax(
{
url: 'url',
success: function(response)
{
prCallback(response);
},
dataType: 'jsonp'
});
function prCallback(response)
{
window.products = response;
}
console.log(products);
products is still an empty array, despite assigning value.