25
rated 0 times
[
28]
[
3]
/ answers: 1 / hits: 35231
/ 11 Years ago, sun, june 30, 2013, 12:00:00
I've got a Javascript function called getCartProducts()
which gets a JSON array via AJAX using $.post()
which returns a value. I want to let my function return that value, but I don't know how to do that.
Here's my function:
function getCartProduct(id){
$.post('core/ajax/getCartProduct.ajax.php', {id: parseInt(id)}, function(data){
var result = data;
});
return result;
}
I know that this wont work, because te variable result is only active in the $.post()
function, but I don't know how to get it straight.
More From » jquery