How to iterate Json type in jquery -
i know extracting value json node in jquery. next code used
$.ajax({ type : 'post', url : '@routes.application.searchitemcodes()', info : { boxnumber : $(this).text(), orgname : 'i099' }, success : function(jsonp) { $.each(jsonp, function(i, item) { console.log(item[0]); }); }, error : function() { alert("error in up") } });
following result getting in console.
object `{itemcode: "8225612", modelname: "m lite ", quantity: 1}`
if print jsonp getting next result in console.
object {data: array[3], status: "success"}
i need iterate array[3]. same has itemcode,modelname , quantity field.for example
data: array[3]: object1:{itemcode: "8225612", modelname: "m lite ", quantity: 1} object2:{itemcode: "8225613", modelname: "m greenish ", quantity: 2} object3:{itemcode: "8225613", modelname: "m lite ", quantity: 3}
please 1 help me extract these 3 objects 1 1 based on itemcode ,modelcode , quantity
try this:
array = jsonp.data; for(i = 0; < array.length; i++){ console.log(array[i]); }
jquery json parsing
No comments:
Post a Comment