Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

simple JSON raw data array display in html section

$
0
0

I am a beginner and I would need help. I have an aspx page which has a table inside there is a div tag as shown below:

<div id="divAcademicFields" class="inside">
  <!--<%= RenderAcademicFields() %> this was server side code and commended as I want to use client now --> 
</div>


I also have a Jquery block on the same page:

<script type="text/javascript">

$(document).ready(function () {

        // get academic fields in a raw data
        $.getJSON('http://services.corp.com/app/academics/?format=json', function(data){
            var custhtml = "";
            $.each( data, function(key, value) {
                var temp = key;
                var temp2 = value;
                custhtml += "<input type=checkbox value=" + temp + " /><label> " + temp2 + "</label><br />"
                //alert( key + ": " + value );
            });

            $("divAcademicFields").append(custhtml);
        });

</script>

The service returns all raw data correctly and I verified. How to display format the row html from JSON and display inside the <div>?

The html should be displayed something similar to the screen

Please assist.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>