Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:58:52+00:00 2026-05-22T20:58:52+00:00

I have the following json output when i call a sample webservice <string>[{Name:Ajay Singh,Company:Birlasoft

  • 0

I have the following json output when i call a sample webservice

<string>[{"Name":"Ajay Singh","Company":"Birlasoft Ltd.","Address":"LosAngeles California","Phone":"1204675","Country":"US"},{"Name":"Ajay Singh","Company":"Birlasoft Ltd.","Address":"D-195 Sector Noida","Phone":"1204675","Country":"India"}]</string>

I am facing problem in parsing this result and appending it to some sample text boxes

This i s my sample html file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="Scripts/Json2.js"></script>
    <script type="text/javascript">
        function testJson() {
            $.ajax({
                type: "POST",
                url: "JsonWebService.asmx/TestJSON",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                                        $("#jsonResponse").html(msg);
                    var data = JSON.parse(msg);
                    alert(data);
                                        var t = "<table border=1> <tr>" +
                                          "<td> <strong>Name</strong></td> <td> " +
                                          "<strong>Company</strong></td> <td> " +
                                          "<strong>Address</strong></td> <td> " +
                                          "<strong>Phone</strong></td> <td> " +
                                          "<strong>Country</strong></td> </tr> ";
                                        jQuery.each(data, function (rec) {
                                            t = t + " <tr> <td> " + this.Name + "</td> <td> " +
                                                this.Company + "</td> <td> " + this.Address +
                                                 "</td> <td> " + this.Phone + "</td> <td> " + this.Country + "</td> </tr> ";
                    var t;
                    jQuery.each(data, function (rec) {
                        t = this.Name;
                        alert(t);
                                                 +" " +
                                                    this.Company + "</td> <td> " + this.Address +
                                                        "</td> <td> " + this.Phone + "</td> <td> " + this.Country + "</td> </tr> ";
                    });

                    t = t + " </table> ";
                    $("#jsonDiv").html(t);
                },
                error : function (msg) {

                }

            });
        };


        function testXml() {
            $.ajax({
                type: "POST",
                url: "JsonWebService.asmx/TestXML",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "xml",
                success: function (msg) {
                    //var data = JSON.parse(msg);
                    alert(msg);
                }
            });
        };
    </script>

</head>
<body>
    <p>
        <input id="testjson" type="button" value="Test JSON Call" onclick="testJson()" />
        <input id="testxml" type="button" value="Test XML Call" onclick="testXml()" />

    </p>
    <br />
    <strong>Message Response</strong>
    <br />
    <div id="jsonResponse" style="display:block;"></div>
    <br />
    <strong>Processed Result</strong>
    <br />
    <div id="jsonDiv" style="display:block;"></div>
</body>
</html>`enter code here`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:58:53+00:00Added an answer on May 22, 2026 at 8:58 pm

    This should work. Change testJson like this.

    function testJson() {
        $.ajax({
            type: "POST",
            url: "JsonWebService.asmx/TestJSON",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                msg = msg.hasOwnProperty("d") ? msg.d : msg;
                $("#jsonResponse").html(msg);
                var data = JSON.parse(msg);
    
                var t = "<table border=1> <tr>" +
                        "<td> <strong>Name</strong></td> <td> " +
                        "<strong>Company</strong></td> <td> " +
                        "<strong>Address</strong></td> <td> " +
                        "<strong>Phone</strong></td> <td> " +
                        "<strong>Country</strong></td> </tr> ";
    
                jQuery.each(data, function (rec) {
                    t += " <tr> <td> " + this.Name + "</td> <td> "
                            + this.Company + "</td> <td> "
                            + this.Address + "</td> <td> "
                            + this.Phone + "</td> <td> "
                            + this.Country + "</td> </tr> ";
                });
    
                t += " </table> ";
    
                $("#jsonDiv").html(t);
            },
            error: function (xhr, status, error) {
                alert(xhr.statusText);
            }
        });
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an json output of the following (ignore the escape characters) {\sEcho\:1,\iTotalRecords\:10,\iTotalDisplayRecords\:10,\aaData\:[{\Job\:\developer\,\Name\:\kurt\},{\Job\:\plumber\,\Name\:\john\}]} which
I have the following json output from a webservice: [ { subCategories: [ {
I have following JSON file to parse: [ { name: kkkk, empid: 55628, address:
I have the following example json output form java/jsonsimple. The JSONArray is: [{dd1:{actionType:Dept,collegeID:}},{dd2:{actionType:Dept,collegeID:}}] I'm
I have the following JSON output and I need to access the variable TN_TEXTO
i have the following JSON Data, which is a respond from my Webservice. {d:
I have a JSON output like the following: [City1,City2,City3] I want to get each
I have the following JSON structure: [{ id:10, class: child-of-9 }, { id: 11,
I have the following json code file named: sections.json { section1: { priority: 1,
I have the following JSON object: { response: { status: 200 }, messages: [

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.