0

first post ever here and kind of a green horn when it comes to programming. so heres the problem, i made a search module that filters emails based on a dropdown list. i did it, worked fine but i want to AJAX the output rather than a simple html table output. problem is i dont have a clue how to convert my code into ajax and or what to put in my JS, any advice could help.

if ($res->num_rows > 0) {
    echo '<div class = "container-fluid">';
    echo '<table class="table table-striped table-bordered table-hover">';
    echo "<tr><th>from_email</th><th>email</th><th>date_added</th></tr>"; 
      while($row=$res->fetch_assoc()){
      echo "<tr><td>"; 
      echo $row['from_email'];
      echo "</td><td>";   
      echo $row['email'];
      echo "</td><td>";    
      echo $row['date_added'];
      echo "</td></tr>";
      }
      echo '</table>';
      echo '</div>';
}   else{
    echo '<div class = "container-fluid">';
    echo "There is no such search Results";
    echo '</div>';
}

so thats how i echo my current output in my html file

if ( $_POST['Type'] == 'domain' && !empty($_POST["search"])) {
    $sql="SELECT email, date_added, from_email FROM mailer_dne WHERE from_email LIKE '%".$search_value."%'";
    $res=$con->query($sql);
}
elseif ( $_POST["Type"] == 'email' && !empty($_POST["search"])) {
    $sql="SELECT email, date_added, from_email FROM mailer_dne WHERE from_email LIKE '$search_value'";
    $res=$con->query($sql);
}

and this is how i filter the search. any advice on how to ajax this?

5

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.