Here am going to explain the use of for loop in JQuery with an example
Add a page ajax_angular_view.php with response format
{"Company1":"IBM","Company2":"TCL","Company3":"GOOGLE"}
HTML Area
<div><input id="update_company_name_comapny1" type="text" value="" /></div> <div><input id="update_company_name_comapny2" type="text" value="" /></div> <div><input id="update_company_name_comapny3" type="text" value="" /></div>
var company_id=1 $.ajax({ url: "ajax_angular_view.php?action=view_company_info_by_id&company_id="+company_id, type: "post", success: function(data) { var obj = JSON.parse(data); for(var k in obj) { $("#update_company_name_"+k).val(obj[k]) } console.log(obj); } });