javascript - Data Tables Jquery Dynamic Fill -
i using datatables in 1 of projects in have fill oracle query results. referring this document.
problem:
all 10 columns returned query displayed in row 1 column 1 of table.
javascript
$('#inquiryform').submit(function(){ var cnic = "data="+ $( "#cnicind" ).val(); //alert(cnic); $.ajax({ type: "post", url: "php/inquiryind.php", data: cnic, success: function(datapage) { //$("#errmsg").html(data).show(); var datacopy = [[datapage]]; prompt("result",datacopy); $('#datatables-example').datatable({ responsive: true, "data": datacopy, columns: [ { title: "policy no." }, { title: "client name" }, { title: "gross premium" }, { title: "next due date" }, { title: "commencement date" }, { title: "cash value" }, { title: "total amount paid" }, { title: "total amount due" }, { title: "total unconsumed amount" }, { title: "status" } ] }); } }); $('#searchtable').show(); return false; });
inquiryind.php
while (($row = oci_fetch_array($stmnt)) != false) { $result = ""; $result .= '"'.$row['proposal']."\""; $result .= ',"'.$row['fullname']."\""; $result .= ',"'.$row['grosspremium']."\""; $result .= ',"'.$row['nextduedat']."\""; $result .= ',"'.$row['commendate']."\""; $result .= ',"'.$row['cash_value']."\""; $result .= ',"'.$row['total_amount_paid']."\""; $result .= ',"'.$row['total_amount_due']."\""; $result .= ',"'.$row['total_amount_due']."\""; $result .= ',"'.$row['status']."\""; //$result .= ']'; $dataset .= $result; //something "tiger nixon", "system architect", "edinburgh", "5421", "2011/04/25", "$320,800" }
please let me know doing wrong. highly appreciated.
Comments
Post a Comment