Load JSON data to Table using Jquery

    "Cities": ["LUSAKA", "HARARE"],
    "Countries": ["ZAMBIA", "ZIMBABWE"]

    <meta charset="utf-8">
    <title>WCF Client</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <table id="location" border='1'>
        var service = 'service.json';

        $(document).ready(function() {

            jQuery.support.cors = true;

                type: "GET",
                // url: service + '/service/',
                url: service,
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                cache: false,
                success: function(data) {

                    var trHTML = '';

                    $.each(data.Countries, function(i, item) {

                        trHTML += '<tr><td>' + data.Countries[i] + '</td><td>' + data.Cities[i] + '</td></tr>';



                error: function(msg) {


You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *