Solved

adding json value to text box

Posted on 2014-07-24
4
168 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now