I am trying to display data that received from jquery post. but it is giving me an error saying undefined
my php json encoded array is this.
[{"matId":"7","matName":"test","matBrand":"est","matPackaging":"1","matWidth":"434","matHeight":"23","matLength":"23","matWeight":"23","matArea":"23","matVolume":"23","matPerPack":"32","supplier1":"19","supplier2":"19","supplier3":"19","requiredInPhase":"","stockItem":"1"}]
then in jquery I am trying to alert one of this value, but it gives error 'undefined'.
this is my jquery code
$('#matId').on('change', function() {
var matId = $(this).val();
$.post('<?php echo base_url() . 'display_mat_details'; ?>', {matId: matId}, function(redata) {
var obj = $.parseJSON(redata);
alert(obj.matId);
});
});