Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

how to make an ajax call return and parse JSON

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
JElster
Asked:
JElster
2 Solutions
 
InsoftserviceCommented:
$.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
 
GaryCommented:
$.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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now