Solved

adding json value to text box

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
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 how to dynamically set the form action using jQuery.
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…

820 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