In my blade, I got this script:-
function itemDetails(item_id){
$.ajax({
type:'GET',
url: './itemDetails/'+item_id,
datatype: 'json',
success: function(response){
$('#modalTitle').text(response.data.name);
$('#modalID').text(response.data.id);
}
});
}
I have another function which I call it when user clicks on the button with parameter,
function currentItem(id, itemAvailability, maxItem){}
Now, how do I call the results in AJAX success into my currentItem
, because i need to store all the data in a new array called items[]
. Can anyone help me T-T
This is the json output incase you need to see:
"data": {
"name": "Fried Chicken Wings",
"id": 99,
"price": "$13.00",
"options": [
{
"id": 1,
"item_id": 99,
"name": "Size",
"options": "small,medium"
}
],
"has_variants": true,
"description": "Fried Chicken Wings"
},
"status": true,
"errMsg": ""
}