1

Pop-up html:

<div class="row" id="get_uv_detail" style="display:none">
  <div class="box border">
    <div class="box-body">
      <div class="uv-more-detail" style="max-height:450px;padding-right:10px" ></div>
    </div>
  </div>
</div>

In controller i have function that returns data like this:

[{"name":"p1"},{"name":"p2"}]

How can I append it in the pop-up?

I have to display data like this:

Name
-----
p1
p2

Here is my script:

.done(function(data) {
$('.uv-more-detail').append(data);
});
// pop-up display
bootbox.dialog({
          message: msg,
          title: title,
          buttons: {
            main: {
              label: "Close",
              className: "btn-primary",
              callback: function() {
                $(".bootbox").modal("hide");
              }
            }
          }
        });
Pathik Vejani
  • 4,263
  • 8
  • 57
  • 98

1 Answers1

0

This is the same answer as link provided by @ParthTrivedi:

$(document).ready(function () {
    $.getJSON(url,
    function (json) {
        var tr;
        for (var i = 0; i < json.length; i++) {
            tr = $('<tr/>');
            tr.append("<td>" + json[i].name+ "</td>");
            tr.append("<td>" + json[i].date+ "</td>");
            $('table').append(tr);
        }
    });
});

For more answers: Parsing JSON objects for HTML table

Community
  • 1
  • 1
Pathik Vejani
  • 4,263
  • 8
  • 57
  • 98