Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to make an ajax call return and parse JSON

Posted on 2014-07-31
2
Medium Priority
?
230 Views
Last Modified: 2014-08-14
Hi..
I have page that returns JSON.

webservice.asp?type='Json'&id=123

Json Looks like this..


[{"ID":805,"TitleId":"1519","UserId":"XXX","Comments":"passed final qa","CommentDate":"3/18/2013 3:26:06 PM","Type":"Public","error_code":null,"Issue":"N","IssueClosed":"N","UpdatedDate":"3/18/2013 3:26:06 PM","UpdatedBy":"XXX"}]


How can I make a ajax call using JQuery  return the JSON and parse it so I place the ID value in the ID field on a form?  What's the syntax
0
Comment
Question by:JElster
[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 Comments
 
LVL 15

Accepted Solution

by:
Insoftservice earned 1000 total points
ID: 40232489
$.ajax({
                    type: "POST",
                    url: Host+'/webservice.asp',
                    data: "ms="+rand+"&type="+json"&id=123",
                    success: function(originalRequest){

                      var response = originalRequest;
                      alert(response)
ar json = $.parseJSON(response);
                        $('#results').html('Plugin name: ' + json.ID+ '<br />Author: ' + json.Titleid);


                    }
                  });
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 1000 total points
ID: 40232606
$.getJSON( "webservice.asp?type=Json&id=123", function( data ) {
	$.each(data, function(i, field){
		$("#someinput").val(field.ID);
	});
});

Open in new window

0

Featured Post

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

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

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…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…

670 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