• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display ajax response in form input box

#1
Hi

I have got this json array from controller

{"plan_id":"7","plan_title":"GOLD","plan_price":"999","resume_limit":"12000","day_limit":"364","job_limit":"20","user":"1","day_break":"0"}


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


Attached Files Thumbnail(s)
   
Reply

#2
Same question...

https://www.google.com/search?q=add+valu...javascript

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.
Reply

#3
Are you sure output content-type is application/json?
Keep calm.
Reply

#4
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.
Reply

#5
(05-07-2017, 01:05 PM)arma7x Wrote: Are you sure output content-type is application/json?

yes
Reply

#6
You can enumerate data object

for ( var key in data) {
if (data.hasOwnProperty(key)) {
console.log(key + " -> " + data
[key]);
}
}
Keep calm.
Reply

#7
Take a look at this http://stackoverflow.com/questions/49684...s-brackets
Keep calm.
Reply

#8
Do your fields have the appropriate ids?

You can post your form and js code.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.