Solved

adding json value to text box

Posted on 2014-07-24
4
171 Views
Last Modified: 2014-07-24
0
Comment
Question by:sevensnake77
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 250 total points
ID: 40217399
result = {"d":[{"ID":22,"ID":20006,"APT":16,"hold":2000.0000},{"ID":21,"ID":20006,"APT":8,"hold":3000.0000},{"ID":20,"ID":20006,"APT":3,"hold":1000.0000}]};

$.each(result.d, function(i, item) {
    $("[name="+this.APT+"]").val(this.hold)
});

Open in new window

0
 
LVL 13

Assisted Solution

by:duncanb7
duncanb7 earned 250 total points
ID: 40217448
Just reminder only from based on Gary's correct code  and  adding  toFixed() function so that the value 2000 to be 2000.0000

result = {"d":[{"ID":22,"ID":20006,"APT":16,"hold":2000.0000},{"ID":21,"ID":20006,"APT":8,"hold":3000.0000},{"ID":20,"ID":20006,"APT":3,"hold":1000.0000}]};

$.each(result.d, function(i, item) {
     $("[name="+this.APT+"]").val(this.hold.toFixed(4));
});

Open in new window


Duncan
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 40217512
thanks
duncanb7 I like the format but the first one is exactly what I needed. Thanks
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40217516
Gary and sevensnake77, Thanks

Have a nice day

Duncan
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now