Solved

how to make an ajax call return and parse JSON

Posted on 2014-07-31
2
222 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 250 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 250 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JavaScript Sort Ordering and Choice Limiting 5 42
JQuery DataTable Functionality 8 54
Scroll 5 news at a time using vticker 2 39
Merge cell above if same 1 25
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
This article discusses how to create an extensible mechanism for linked drop downs.
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…

734 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