CodeIgniter Forums

Full Version: display ajax response in form input box
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I have got this json array from controller


Now i want to display the values in the forms input 

I try this but it does not display the plan_price (999) in the input field

document.getElementById("plan_price").value = data.plan_price; 

Please help
Same question...

According to your attached image is possible see that your resume_limit is an object.

Add console.log(data) after the variable data and check the responses.
Are you sure output content-type is application/json?
i check with console.log it display value correctly, also the json values are showing correctly.

Still i am unable to display array[0] in 1st input box
                                        array[1] in 2st input box
                                        array[2] in 3rd input box
                                        array[3] in 4th input box

Help is appreciated.
(05-07-2017, 12:05 PM)arma7x Wrote: [ -> ]Are you sure output content-type is application/json?

You can enumerate data object

for ( var key in data) {
if (data.hasOwnProperty(key)) {
console.log(key + " -> " + data
Do your fields have the appropriate ids?

You can post your form and js code.