function getFolderCardsNumber(folder) {
jQuery.ajax({
type: 'post',
url: 'script.php',
data: {folder: folder},
success: function (result)
{
var response = JSON.parse(result);
console.log('in folder ' + folder + ' there are '+response + ' cards');
return response;
},
error: function (result)
{
console.log('error');
}
});
}
The value in console is correct, so it looks to work fine. But here I get undefined!jQuery(document).ready(function ()
{
var pc_cards_number, sp_cards_number;
pc_cards_number = getFolderCardsNumber('PC');
console.log('inner PC is '+pc_cards_number);
sp_cards_number = getFolderCardsNumber('SP');
console.log('inner SP is '+sp_cards_number);
});
Thnk you so mutch.
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.