- Tue Oct 24, 2017 7:14 pm
#795972
Good morning,
Could I ask how to pass the json value into a grid? Please see my code,
And this is the code to append a new option for a dropdown, how to append a value into a textbox?
$("#form\\[grid_order\\]\\[" + i + "\\]\\[item\\]").append(new Option( myJSON.item , myJSON.item ));
Many thanks,
Yxu
Could I ask how to pass the json value into a grid? Please see my code,
Code: Select all
I have successful get the value for myJSON, however how can I populate these values into a grid? (I am using web-entry form so the trigger before a form will not work).xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
//// convert to json pattern//////////////////////////////
myJSON = JSON.parse(xmlhttp.responseText);
for (var i = 1; i <= Object.keys(myJSON).length; i++) {
$("#grid_order").setValue(myJSON[i].price, i, 4);
$("#grid_order").addRow();
}
}
}
xmlhttp.open("GET", "http://localhost/search.php?a="+a, true);
xmlhttp.send();
And this is the code to append a new option for a dropdown, how to append a value into a textbox?
$("#form\\[grid_order\\]\\[" + i + "\\]\\[item\\]").append(new Option( myJSON.item , myJSON.item ));
Many thanks,
Yxu