Ho eto use datatable plugin for Json data from an Url

Ho eto use datatable plugin for Json data from an Url

ParijatParijat Posts: 1Questions: 1Answers: 0

I have prepared a datatable using 'local' json data(text file present in the same machine). But actually it needs to take the json data using url(http://.....). And also need to apply dd-mmm-yyyy plugin along with number format(no decimal and thousand separator). My Code here as:
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../resources/demo.css">
<style type="text/css" class="init">

<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../resources/demo.js"></script>

<script type="text/javascript" language="javascript" class="init">

$(document).ready(function() {

var oTable = $('#example').dataTable( {

 "ajax": "objectsGR.txt",

"columns": [

{ "data": "invoice_no" },
{ "data": "invoice_date"},
{ "data": "posting_date" },
{ "data": "gr_ir" },
{ "data": "quantity" },
{ "data": "document_currency" },
{ "data": "due_date" },
{ "data": "cost_loc" },
{ "data": "cost_doc" },
{ "data": "payment_status" },
{ "data": "clearing_date" }

    ]


} );

} );
</script>
<h1 align="center">IR/GR View</h1>

</head>

<body class="dt-example">

        <table id="example" class="display" cellspacing="0" width="90%">
            <thead>
                <tr>

<th>Invoice No.</th>
<th>Invoice Date</th>
<th width=5%>Posting Date</th>
<th width=5%>IR/GR</th>
<th width=5%>Quantity</th>
<th width=5%>Document Curr.</th>
<th>Due Date</th>
<th width=5%>Cost LOC</th>
<th width=5%>Cost DOC</th>
<th width=5%>Payment Status</th>
<th>Clearing Date</th>

                </tr>
            </thead>


        </table>

</body>
</html>

Answers

This discussion has been closed.