How to fetch data in to datatables using jquery and ajax

by Naga Phaneendra   Last Updated February 11, 2019 09:24 AM

i have written code to post a values to getdata.php file and from that file i am getting some data in the format. i write a script code like this.

function getId(val) {



and the php file look like this

 $text1 = $_POST['text1'];

  $sql = "SELECT tbname FROM vehicle WHERE vid = '$text1'";
  $result = mysqli_query($db,$sql);
  $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  $count = mysqli_num_rows($result);
  foreach ($result as $vehicle){
   $tbname = $vehicle["tbname"];
   //echo $tbname;
  $sql = "SELECT * FROM $tbname  WHERE vid = '$text1'";
  $result1 = mysqli_query($db,$sql);

    while($data = mysqli_fetch_array($result1)){
            echo "<tr>



i am getting data from server ,it is fine.But i want to put the comming result from php file in to to change my script code to append data to datatables. i want this result to be in datatables. please help me.

Related Questions

Ajax call to wcf is returning undefined

Updated May 08, 2019 16:24 PM

StackOverflow is not working with AJAX

Updated February 09, 2019 12:24 PM