I want to extract JSON data from laravel using JQUERY but the result is always undefined.
this is the json code I've got:
{"data":{"id":1,"title":"glove hard","code":"0102","category":"glove"}}
and this is the js code:
$('#show').click(function(){
$.ajax({
url: 'example.com/api/product/1',
method: 'GET',
dataType: 'json',
success: function(data){
$('#result').text(data.category)
}
})
})