Solved

adding json value to text box

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to dynamically set the form action using jQuery.
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)

803 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