JavaScript Dynamic Link on search result dynamic-link library search order

I want to automatically fill out the div with id= id, name, email, company.. after a click on any search result. The id from the search result is used as filter to get the appropriate row from Mysql data is coming from the same table used in search.php

here is my form

<link target='_blank' href="../action/css/onlinecustom.css" rel="stylesheet"     type="text/css">
<script src="http://code.jquery.com/jquery-1.10.2.js"  type="text/javascript"></script>
<script src="./action/scripts/global2.js" type="text/javascript"></script> 

<script>
function searchq() {
    var searchTxt = $("input[name='search']").val();

     $.post("../action/subs/search.php/", {searchVal: searchTxt}, function(output) {
         $("#output").html(output);
     });
 }

</script>

<title>Search</title>

<body>
<form action="http://comiut.com/index.php/user-records" method="post">
  <input type="text" name="search" Placeholder="enter the search    criteria..." onkeydown="searchq();"/>
  <input type="submit" value ="serach"/>

</form>
//Serach result//
<div id="output"> </div>

//Data to populate upon click on any search result//
    <div id="id"></div> 
    <div id="name"></div>
    <div id="email"></div>
    <div id="company_name"></div>

</body>

** I created a global2.js file **

jQuery('body').on('click', 'a.resultItem', function(e) {
e.preventDefault();
jQuery.ajax({
    url: "http://onlinepcdoc.com/action/subs/getItem.php",
    method: 'post',
    data : jQuery(this).data('id') // see the data attribute we used above in the a tag we constructed
}).done(function(data) {
    jQuery("#id").html(data.id);
    jQuery("#name").html(data.name);
    jQuery("#email").html(data.email);
    jQuery("#company_name").html(data.company);
   });
});

I also created search.php

<?php 

    include '../db/connect6.php';


if(isset($_POST['searchVal'])) {
  $searchq = $_POST['searchVal'];
  $searchq = preg_replace ("#[^0-9a-z]#i","",$searchq);

  $query = mysql_query("SELECT * FROM oz2ts_users WHERE oz2ts_users.id LIKE '%$searchq%' OR oz2ts_users.name LIKE '%$searchq%'") or die("Could not search"); 
  $count = mysql_num_rows($query);
  if($count == 0){
     $output = 'There is no result to show!'; 
       } else{ 
        while($row = mysql_fetch_array ($query)) {
            $id = $row['id'];
            $name = $row['name'];
            $username = $row['username'];    

      $output .= '<div><a class="resultItem" data-id="' . $id . '">'   
       . $name . ' '.$username.'</a></div>';   

   }            
 }

 }
echo($output);
?>

** Here is the getItem.php **

<?php

include '../db/connect6.php';

if(isset($_POST['id'])) {
    $id = intval($_POST['id']);
    $result = mysqli_query("SELECT oz2ts_users.id, oz2ts_users.name,    oz2ts_users.username,  oz2ts_users.email FROM oz2ts_users WHERE oz2ts_users.id =      $id") or die("Could not search"); 
    // since we expect only one result we don't need a loop
    $row = mysqli_fetch_assoc($result);
    // let's return the $row in json format
    // first let's prepare the http header
    header('Content-Type: application/json');
    // and now we return the json payload
    echo json_encode($row);
}

?>
Answer:1

I am trying to have a Semantic UI dropdown menu which allows additions but I can seem to make it work. Indeed the Add <b>{term}</b> message that is supposed to appear when adding something ...

I am trying to have a Semantic UI dropdown menu which allows additions but I can seem to make it work. Indeed the Add <b>{term}</b> message that is supposed to appear when adding something ...

I am using Firebase to generate a unique key using .push().key Each instance I have seen is exactly 20 characters. Are they always 20 characters? As I plan on adding string length to my firebase rules....

I am using Firebase to generate a unique key using .push().key Each instance I have seen is exactly 20 characters. Are they always 20 characters? As I plan on adding string length to my firebase rules....

  1. firebase push token length
  2. firebase push notification length
  3. firebase push notification max length
  4. firebase push notification token length
  5. firebase push length

Updated at : {{res.updated_at}} Value: {"updated_at":"2017-04-12T21:46:20Z"} I need to change this 2017-04-12T21:46:20Z to 2017-04-12 21:46:20 by removing T and Z. Please help how to achieve this. ...

Updated at : {{res.updated_at}} Value: {"updated_at":"2017-04-12T21:46:20Z"} I need to change this 2017-04-12T21:46:20Z to 2017-04-12 21:46:20 by removing T and Z. Please help how to achieve this. ...

here is my code: https://jsfiddle.net/hsf4yo5t/ HTML code: <input type="button" id="my-button" value="Show text input"> <input type="text" id="my-input"> CSS code: #my-input { ...

here is my code: https://jsfiddle.net/hsf4yo5t/ HTML code: <input type="button" id="my-button" value="Show text input"> <input type="text" id="my-input"> CSS code: #my-input { ...