Получить значение на основе строки php echo на основе щелчка

Как получить значение по щелчку строки в этой кодировке? Помоги мне, пожалуйста....

function addRowHandlers() {
  var tbody = $("#employee-click"); //document.getElementById("employee- 
  click ");
  tbody.each(function() {
    $(this).on('click', function() {
      var url = new URL(window.location.href);
      var no = url.searchParams.get("no");

      window.location.href = "detail.php?no = " + no;

    })
  })
}

в

<body  onload = "addRowHandlers()">
	
	
 
		<div class = "header"><h1>Data Biodata</h1></div>
		<div class = "container" >
           <!-- <center> <button style = "right:150"> <a href = "Biodata.php">Create New</a></button></center>-->
			<table id = "employee-grid" class = "display" cellpadding = "5" cellspacing = "1"
			width = "100%" border = "1" style = "text-align: justify;">
				<thead>
					<tr>
						<th>NO</th>
						<th>SVC NO</th>
						<th>RANK</th>
						<th>NAME</th>
						<th>YEAR</th>
						<th>SYSTEM</th>
						<th>COURSE</th>
						<th>F</th>
						<th>1</th>
						<th>2</th>
						<th>3</th>
						<th>4</th>
						<th>5</th>
						<th>6</th>
						<th>7</th>
						<th>8</th>
						<th>9</th>
						<th>10</th>
						
					</tr>
				</thead>
				
				<thead>
					<tr>
						<td><input type = "text" id = "0" class = "employee-search-input"></td>
						
						<td><input type = "text" id = "1" class = "employee-search-input"></td>
						<td><input type = "text" id = "2" class = "employee-search-input" ></td>
						<td><input type = "text" id = "3" class = "employee-search-input" ></td>
						<td><input type = "text" id = "4" class = "employee-search-input" ></td>
						<td><input type = "text" id = "5" class = "employee-search-input" ></td>
						<td><input type = "text" id = "6" class = "employee-search-input" ></td>
						<td><input type = "text" id = "7" class = "employee-search-input" ></td>
						<td><input type = "text" id = "8" class = "employee-search-input" ></td>
						<td><input type = "text" id = "9" class = "employee-search-input" ></td>
						<td><input type = "text" id = "10" class = "employee-search-input" ></td>
						<td><input type = "text" id = "11" class = "employee-search-input" ></td>
						<td><input type = "text" id = "12" class = "employee-search-input" ></td>
						<td><input type = "text" id = "13" class = "employee-search-input" ></td>
						<td><input type = "text" id = "14" class = "employee-search-input" ></td>
						<td><input type = "text" id = "15" class = "employee-search-input" ></td>
						<td><input type = "text" id = "16" class = "employee-search-input" ></td>
						<td><input type = "text" id = "17" class = "employee-search-input" ></td>
						</tr>
				</thead>
				<tbody id = "employee-click">
					<tr>
                        <th>NO</th>
						<th>SVC NO</th>
						<th>RANK</th>
						<th>NAME</th>
						<th>YEAR</th>
						<th>SYSTEM</th>
						<th>COURSE</th>
						<th>F</th>
						<th>1</th>
						<th>2</th>
						<th>3</th>
						<th>4</th>
						<th>5</th>
						<th>6</th>
						<th>7</th>
						<th>8</th>
						<th>9</th>
						<th>10</th>
						
                       
					</tr>
    </tbody>
			</table>
		</div>
		
	</body>

	$(document).ready(function() {
				
				
			var dataTable =  $('#employee-grid').DataTable( {
				processing: true,
				serverSide: true,
				ajax: "dataBiodata.php", // json datasource
				 
			
				} );

             
           
          


					
				$("#employee-grid_filter").css("display","none");  // hiding global search box
				
				$('.employee-search-input').on( 'keyup click change', function () {   
					var i =$(this).attr('id');  // getting column index
					var v =$(this).val();  // getting search input value
					dataTable.columns(i).search(v).draw();
				} );
			} );
			
    function addRowHandlers() {
    var tbody = $("#employee-click"); //document.getElementById("employee-click");
    tbody.each(function() {
    $(this).on('click', function() {     
    var url =new URL (window.location.href);
     var no = url.searchParams.get("no");
	  //window.location.href  = "detail.php?no = "+no;
	   alert(no);
	 		
    })
  })
}
<body  onload = "addRowHandlers()">
	
	
 
		<div class = "header"><h1>Data Biodata</h1></div>
		<div class = "container" >
           <!-- <center> <button style = "right:150"> <a href = "Biodata.php">Create New</a></button></center>-->
			<table id = "employee-grid" class = "display" cellpadding = "5" cellspacing = "1"
			width = "100%" border = "1" style = "text-align: justify;">
				<thead>
					<tr>
						<th>NO</th>
						<th>SVC NO</th>
						<th>RANK</th>
						<th>NAME</th>
						<th>YEAR</th>
						<th>SYSTEM</th>
						<th>COURSE</th>
						<th>F</th>
						<th>1</th>
						<th>2</th>
						<th>3</th>
						<th>4</th>
						<th>5</th>
						<th>6</th>
						<th>7</th>
						<th>8</th>
						<th>9</th>
						<th>10</th>
						
					</tr>
				</thead>
				
				<thead>
					<tr>
						<td><input type = "text" id = "0" class = "employee-search-input"></td>
						
						<td><input type = "text" id = "1" class = "employee-search-input"></td>
						<td><input type = "text" id = "2" class = "employee-search-input" ></td>
						<td><input type = "text" id = "3" class = "employee-search-input" ></td>
						<td><input type = "text" id = "4" class = "employee-search-input" ></td>
						<td><input type = "text" id = "5" class = "employee-search-input" ></td>
						<td><input type = "text" id = "6" class = "employee-search-input" ></td>
						<td><input type = "text" id = "7" class = "employee-search-input" ></td>
						<td><input type = "text" id = "8" class = "employee-search-input" ></td>
						<td><input type = "text" id = "9" class = "employee-search-input" ></td>
						<td><input type = "text" id = "10" class = "employee-search-input" ></td>
						<td><input type = "text" id = "11" class = "employee-search-input" ></td>
						<td><input type = "text" id = "12" class = "employee-search-input" ></td>
						<td><input type = "text" id = "13" class = "employee-search-input" ></td>
						<td><input type = "text" id = "14" class = "employee-search-input" ></td>
						<td><input type = "text" id = "15" class = "employee-search-input" ></td>
						<td><input type = "text" id = "16" class = "employee-search-input" ></td>
						<td><input type = "text" id = "17" class = "employee-search-input" ></td>
						</tr>
				</thead>
				<tbody id = "employee-click">
					<tr>
                        <th>NO</th>
						<th>SVC NO</th>
						<th>RANK</th>
						<th>NAME</th>
						<th>YEAR</th>
						<th>SYSTEM</th>
						<th>COURSE</th>
						<th>F</th>
						<th>1</th>
						<th>2</th>
						<th>3</th>
						<th>4</th>
						<th>5</th>
						<th>6</th>
						<th>7</th>
						<th>8</th>
						<th>9</th>
						<th>10</th>
						
                       
					</tr>
    </tbody>
			</table>
		</div>
		
	</body>
</html>







<?php
/* Database connection start */
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "testdb";

$conn = mysqli_connect($servername, $username, $password, $dbname) or die("Connection failed: " . mysqli_connect_error());

/* Database connection end */


// storing  request (ie, get/post) global array to a variable  
$requestData= $_REQUEST;

$columns = array( 
// datatable column index  => database column name
	0 => 'no', 
	1 => 'svcno',
	2 => 'pangkat',
	3 => 'name',
	4=> 'year',
	5 => 'system',
	6 => 'course',
	7 => 'f1',
	8 => 'f2',
	9=> 'f3',
	10 => 'f3',
	11 => 'f4',
	12 => 'f5',
	13 => 'f6',
	14 => 'f7',
	15 => 'f8',
	16 => 'f9',
	17 => 'f10',
	18 => 'f11',
);



// getting total number records without any search
$sql = "SELECT no";
$sql. = " FROM av";
$query=mysqli_query($conn, $sql) or die("dataBiodata.php: get biodata");
$totalData = mysqli_num_rows($query);
$totalFiltered = $totalData;  // when there is no search parameter then total number rows = total number filtered rows.


$sql = "SELECT no,svcno,pangkat,name,year,system,course,f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11";
$sql. = " FROM av WHERE 1=1";
if ( !empty($requestData['columns'][0]['search']['value']) ){
	$sql. = " AND  no LIKE '".$requestData['columns'][0]['search']['value']."%' ";    
}
if ( !empty($requestData['columns'][1]['search']['value']) ){
	$sql. = " AND  svcno LIKE '".$requestData['columns'][1]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][2]['search']['value']) ){
	$sql. = " AND  pangkat LIKE '".$requestData['columns'][2]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][3]['search']['value']) ){
	$sql. = " AND  name LIKE '".$requestData['columns'][3]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][4]['search']['value']) ){
	$sql. = " AND  year LIKE '".$requestData['columns'][4]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][5]['search']['value']) ){
	$sql. = " AND  system LIKE '".$requestData['columns'][5]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][6]['search']['value']) ){
	$sql. = " AND  course LIKE '".$requestData['columns'][6]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][7]['search']['value']) ){
	$sql. = " AND  f1 LIKE '".$requestData['columns'][7]['search']['value']."%' ";
}
if ( !empty($requestData['columns'][8]['search']['value']) ){
	$sql. = " AND  f2 LIKE '".$requestData['columns'][8]['search']['value']."%' ";
}



$query=mysqli_query($conn, $sql) or die("dataBiodata.php: get biodata");
$totalFiltered = mysqli_num_rows($query); // when there is a search parameter then we have to modify total number filtered rows as per search result. 
$sql. = " ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
/* $requestData['order'][0]['column'] contains column index, $requestData['order'][0]['dir'] contains order such as asc/desc  */	
$query=mysqli_query($conn, $sql) or die("dataBiodata.php: get biodata1");
	

$data = array();
while( $row=mysqli_fetch_array($query) ) {  // preparing an array
	$nestedData=array(); 
	$nestedData[] = $row["no"];
	$nestedData[] = $row["svcno"];
	$nestedData[] = $row["pangkat"];
	$nestedData[] = $row["name"];
	$nestedData[] = $row["year"];
	$nestedData[] = $row["system"];
	$nestedData[] = $row["course"];
	$nestedData[] = $row["f1"];
	$nestedData[] = $row["f2"];
    $nestedData[] = $row["f3"];
    $nestedData[] = $row["f4"];
    $nestedData[] = $row["f5"];
    $nestedData[] = $row["f6"];
    $nestedData[] = $row["f7"];
    $nestedData[] = $row["f8"];
    $nestedData[] = $row["f9"];
    $nestedData[] = $row["f10"];
    $nestedData[] = $row["f11"];

	$data[] = $nestedData;
	

}



$json_data = array(
			"draw"            => intval( $requestData['draw'] ),   // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. 
			"recordsTotal"    => intval( $totalData ),  // total number of records
			"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
			"data"            => $data   // total data array
			);

echo json_encode($json_data);  // send data as json format


?>
this is the full code. anyone know how to do it, please do not hesitate to share with me.

Без HTML как это сделать?

Jaydeep Mor 17.05.2018 10:29

Нам также нужно увидеть HTML-код, и я бы включил в теги тег Jquery или javascript. Я думаю, что PHP не подходит в этом вопросе.

Ricard Espinàs Llovet 17.05.2018 10:38
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
В JavaScript одним из самых запутанных понятий является поведение ключевого слова "this" в стрелочной и обычной функциях.
Концепция локализации и ее применение в приложениях React ⚡️
Концепция локализации и ее применение в приложениях React ⚡️
Локализация - это процесс адаптации приложения к различным языкам и культурным требованиям. Это позволяет пользователям получить опыт, соответствующий...
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
В настоящее время производительность загрузки веб-сайта имеет решающее значение не только для удобства пользователей, но и для ранжирования в...
Безумие обратных вызовов в javascript [JS]
Безумие обратных вызовов в javascript [JS]
Здравствуйте! Юный падаван 🚀. Присоединяйся ко мне, чтобы разобраться в одной из самых запутанных концепций, когда вы начинаете изучать мир...
Система управления парковками с использованием HTML, CSS и JavaScript
Система управления парковками с использованием HTML, CSS и JavaScript
Веб-сайт по управлению парковками был создан с использованием HTML, CSS и JavaScript. Это простой сайт, ничего вычурного. Основная цель -...
JavaScript Вопросы с множественным выбором и ответы
JavaScript Вопросы с множественным выбором и ответы
Если вы ищете платформу, которая предоставляет вам бесплатный тест JavaScript MCQ (Multiple Choice Questions With Answers) для оценки ваших знаний,...
0
2
46
0

Другие вопросы по теме