0

同じページにデータを表示しようとすると正常に動作しますが、そのページにデータが追加された新しいウィンドウ/タブを開く必要があります

$.ajax({
    async : true,
    type : 'GET',
    cache : false,
    url : 'rest/getReport',
    data : 'startDate=' + fromDate + '&endDate=' + toDate,
    datatype : 'json',
    success : function (data) {
        that.viewReport(data);
    },

    complete : function (data) {
          $('#search-box').find('img.waiting').css('visibility', 'hidden');
    }
});

これは成功時に呼び出されるメソッドです

viewReport : function (data) {
    var table;
    window.open("details.htm");
    table = $('#Report table');//#report is id of div in details.htm
    if (data.length == 0) {
        $('#Report .no-view-error').show();
        return;
    }
    table.empty();
    $.each(data, function (index, item) {
        var row = '<tr id="tkNo-' + item.num + '">';
        row += '<td>' +item.Date + '</td>';
        row += '<td>' +item.Type + '</td>';
        row += '<td>' +item.Num + '</td>';
        row += '<td>' +item.receivedDate + '</td>';
        row += '<td>' +item.doneBy + '</td>';
        row += '<td>' +item.comments + '</td>';
        row += '</tr>';
    table.append(row);//appending rows to table in the new page
    });
}

私のjspページでは、コードは

<div id="Report" class="showDetails">
<div class="error-box no-view-error">There are no details in this period.</div>
<table></table>
</div>
4

1 に答える 1