Solved

adding json value to text box

Posted on 2014-07-24
4
177 Views
Last Modified: 2014-07-24
0
Comment
Question by:Seven price
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Seven price
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

717 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