How can I hide a particular <tr> based on php variable associated with that <tr>(incremental variable $i) with jQuery when the table is being populated dynamically through Mysql. I have looked around but not getting any clue.
<table id="example">
<thead>
<tr>
<th>S.No.</th>
<th>Item Number</th>
<th>Question</th>
<th>Option-A</th>
<th>Option-B</th>
<th>Option-C</th>
<th>Option-D</th>
<th style="text-align: center;">Correct Ans.</th>
<th style="text-align: center;">Marks</th>
<th style="text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<?php
if ($query != '') {
$res = mysql_query($query) ;
$i = 1;
while($row = mysql_fetch_array($res))
{
extract($row);
?>
<tr class="record">
<td><?php echo $i ; ?></td>
<td><?php echo $item_no ; ?></td>
<td><?php echo $level_id ; ?></td>
<td><textarea disabled name="question" rows="4" cols="35"><?php echo $question ; ?></textarea></td>
<td><?php echo $option_A ; ?></td>
<td><?php echo $option_B ; ?></td>
<td><?php echo $option_C ; ?></td>
<td><?php echo $option_D ; ?></td>
<td><?php echo $correct_ans ; ?></td>
<td><?php echo $marks ; ?></td>
<td> </td>
<script type="text/javascript" >
$(function() {
$(".delbutton").click(function() {
var del_id = $(this).attr("id");
var info = 'id=' + del_id;
var $tr = $(this).closest('tr');
if (confirm("Sure you want to delete this post? This cannot be undone later.")) {
$.ajax({
type : "POST",
url : "delete_entry.php", //URL to the delete php script
data: info,
success : function(response) {
if(response=='deletion success'){
$tr.find('td').fadeOut(1000,function(){ $tr.remove(); });
}
}
});
}
return false;
});
});
</script>
</tr>
<?php $i++; } }
</tbody>
</table>
And my ajax page,
<?php
header('Content-Type: application/json');
session_start();
require("../config.php");
require("../Database.class.php");
require("../site.php");
$db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$fnc=new site_functions($db);
$id = $_POST['id'];
$deleted_date = date("Y-m-d h:i:s");
$deleted_by = $_SESSION['session_admin_id'] ;
$nots = $db->idToField("tbl_ques","notes",$id);
if ($nots == "")
{
$date_string = "last deleted on|".$deleted_date."|" ;
}
else {
$date_string = $nots."last deleted on|".$deleted_date."|" ;
}
$fnc->update_is_not_deleted_for_Pearsonvue("tbl_ques",$id, "$deleted_date", $deleted_by);
$notes_data = array("notes"=>$date_string);
if($db->query_update("tbl_ques", $notes_data, "id=$id")){
http_response_code();
echo json_encode('deletion success');
}else{
http_response_code(204);
}
?>
You are already close - in fact it looks like your code should work on the first click at least. Anyway,
Change line
$tr.find('td').fadeOut(1000,function(){ $tr.remove(); });
to
$('#' + del_id).closest('tr').remove(); });
What this does is find the delete button element in the DOM, then look 'up' the DOM structure to the first TR element, and remove that from the DOM.
It is generally better to rely on simple variables within async callbacks because relying on objects, such as $this or in your case $tr can cause issues where the object pointed to by the $tr variable is not the one you expected.
EDIT: Added the working snippet below to illustrate the technique. If you still have a problem please create a minimal verifiable version as a snippet from your code so that we can pinpoint the issue.
$('.del').on('click', function() {
$(this).closest('tr').remove();
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="example">
<thead>
<tr>
<th>First name</th>
<th>Second name</th>
<th>Age</th>
<th style="text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>Joe</td>
<td>Bloggs</td>
<td>22</td>
<td style="text-align: center;">
<button id='A1' class='del'>Delete</button>
</td>
</tr>
<tr>
<td>Jane</td>
<td>Bloggs</td>
<td>19</td>
<td style="text-align: center;">
<button id='A2' class='del'>Delete</button>
</td>
</tr>
<tr>
<td>Joanne</td>
<td>Bloggs</td>
<td>28</td>
<td style="text-align: center;">
<button id='A3' class='del'>Delete</button>
</td>
</tr>
</tbody>
</table>
Related
I am looking to insert rows to the table but
The rows are echoed but not displayed inside the table.
The HTML code of the project is:
<div class="container">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>SN</th>
<th>Category</th>
<th>Parent</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="displayCategory">
</tbody>
</table>
</div>
The main.js file of the project is:
It fetches data from the PHP file below:
$(document).ready(function () {
manageCategory();
function manageCategory(){
$.ajax({
url: DOMAIN + "/includes/process.php",
method: "POST",
data: { manageCategory: 1 },
success: function (data) {
$("#displayCategory").html(data);
alert(data);
console.log(data);
}
})
};
}
PHP code of the project is:
<?PHP
if (isset($_POST["manageCategory"])) {
$m = new Manage();
$result = $m->manageTableWithPagination('pdcts_categories', 1);
$rows = $result['rows'];
$pagination = $result['pagination'];
if (count($rows) > 0) {
foreach ($rows as $row) {
$n = 0;
?>
<tr>
<td><?php echo ++$n; ?></td>
<td><?php echo $row["Category"]; ?></td>
<td><?php echo $row["Parent"]; ?></td>
<td>
Active
</td>
<td>
Edit
Delete
</td>
</tr>
<?php
}?>
<!-- <tr><td colspan="5"><?php echo $pagination; ?></td></tr> -->
<?php exit(); }
}?>
Try appending data (insted of html) like so:
$("#displayCategory").append(data);
note: check in the console that your php code is returning valid html (<tr> data)
I have displayed a table of data from MYSQL DB. I have a button to export to excel. When I click on the button the excel file is created but it is empty or sometimes nothing is happening. What could be wrong here?
I have code like below:
view.php:
<div id="div_users">
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th class="mn_th01">#</th>
<th class="mn_th02">Date</th>
<th class="mn_th03">Name</th>
<th class="mn_th04">Place</th>
<th class="mn_th05">Notes</th>
<th class="mn_th06">Sales Exec.</th>
<th class="mn_th07">Image</th>
</tr>
</thead>
<tbody>
<?php
date_default_timezone_set('Asia/Kolkata');
$date = date('d/m/Y', time());
echo $date . "\n";
$count=1;
$query = "SELECT * FROM ua_myadd_details WHERE STR_TO_DATE(notes_date,'%d/%m/%y') = STR_TO_DATE('$date', '%d/%m/%y') ORDER BY M.id DESC";
$result = mysqli_query($bd,$query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo $row["notes_date"]; ?></td>
<td><?php echo $row["firstname"] . " " . $row["lastname"]; ?></td>
<td><?php echo $row["city"]; ?></td>
<td><?php echo $row["notes"]; ?></td>
<td><?php echo $row["executive"]; ?></td>
</tr>
<?php $count++; }
}
else
{?>
<tr>
<td colspan="7">
<?php echo "No Data Found"; ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
I have a button like this:
<div class="col-md-3">
<button name="create_excel" id="create_excel" class="btn btn-success btn-block"><i class="fas fa-arrow-alt-circle-down"></i> Export to Excel</button>
</div>
In the script I have written:
<script>
$(document).ready(function(){
$('#create_excel').click(function(){
var excel_data = $('#div_users').html();
var page = "export.php?data=" + excel_data;
window.location = page;
});
});
</script>
export.php:
<?php
header('Content-Type: application/vnd.ms-excel');
header('Content-disposition: attachment; filename='.rand().'.xls');
echo $_GET["data"];
?>
I am trying to get data from mysql table using php ajax. it showing when I select the filter from select option but when I change the select another value for filter it does not reset the table but it append new result with old result. when page load it should not filter it should filter when select filter option.
My PHP to get data from data base.
<?php
if(!empty($_POST["assign_to"])){
$filter = $_POST["assign_to"];
$sql = "SELECT * FROM projects WHERE assign_to ='".$filter ."' ";
$result = mysqli_query($connect, $sql);
$output = array();
while($row = mysqli_fetch_assoc($result))
{
$output[] = $row;
}
echo json_encode($output);
}
Filter HTML
<select id="user_ids" class="form-control" name="assign_to" required="">
<option value="">Select User</option>
<option value="85">Manager</option>
<option value="86">User 1</option>
<option value="87">User 2</option>
<option value="88">User 3</option>
</select>
Script for AJAX Call
function fetch_project_data_filtered() {
$("#user_ids").change(function(){
var assign_to = $(this).val();
var dataString = "assign_to="+assign_to;
//alert(assign_to);
$.ajax({
type: "POST",
url: "x-fetch.php",
data: dataString,
dataType:"json",
success: function(data)
{
for(var count=0; count<data.length; count++)
{
var html_data = '<tr><td>'+data[count].project_id+'</td>';
html_data += '<td data-name="project_name" class="project_name" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].project_name+'</td>';
html_data += '<td data-name="created_on" class="created_on" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].created_on+'</td>';
html_data += '<td data-name="target_date" class="target_date" data-type="date" data-pk="'+data[count].project_id+'">'+data[count].target_date+'</td>';
html_data += '<td data-name="assign_to" class="assign_to" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].assign_to+'</td>';
html_data += '<td data-name="current_status" class="current_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].current_status+'</td>';
html_data += '<td data-name="previous_status" class="previous_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].previous_status+'</td>';
html_data += '<td data-name="cito_comment" class="cito_comment" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].cito_comment+'</td>';
$('#project_data').append(html_data);
}
}
});
});
}
You can use empty method beforeSend ajax
function fetch_project_data_filtered() {
$("#user_ids").change(function(){
var assign_to = $(this).val();
var dataString = "assign_to="+assign_to;
//alert(assign_to);
$.ajax({
type: "POST",
url: "x-fetch.php",
data: dataString,
dataType:"json",
beforeSend: $('#project_data').empty(),
success: function(data)
{
for(var count=0; count<data.length; count++)
{
var html_data = '<tr><td>'+data[count].project_id+'</td>';
html_data += '<td data-name="project_name" class="project_name" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].project_name+'</td>';
html_data += '<td data-name="created_on" class="created_on" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].created_on+'</td>';
html_data += '<td data-name="target_date" class="target_date" data-type="date" data-pk="'+data[count].project_id+'">'+data[count].target_date+'</td>';
html_data += '<td data-name="assign_to" class="assign_to" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].assign_to+'</td>';
html_data += '<td data-name="current_status" class="current_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].current_status+'</td>';
html_data += '<td data-name="previous_status" class="previous_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].previous_status+'</td>';
html_data += '<td data-name="cito_comment" class="cito_comment" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].cito_comment+'</td>';
$('#project_data').append(html_data);
}
}
});
});
}
You can return table from AJAX page in html table form.
HRML Select Box.
<select name="scanType" id="type" class="form-control m-bot15">
<option selected disabled>-select type-</option>
<option value="all">All</option>
<option value="USG">USG</option>
<option value="CT">CT</option>
<option value="X-RAY">X-RAY</option>
<option value="MR">MR</option>
<option value="LAB">LAB</option>
</select>
JavaScript function which runs onSubmit().
function SearchData() {
var fromDate = $('#fromDates').val();
var toDate = $('#toDates').val();
var type = $('#type').val();
var url = 'ajax_searchData.php?from='+fromDate+'&&to='+toDate+'&&type='+type;
$.ajax({
type: 'GET',
url: url,
dataType: 'html',
success: function (data) {
$('#LoadTable').html(data);
}
})
}
ajax_searchData.php Page
<?php
include('config.php');
$fromDate = $_GET['from'];
$toDate = $_GET['to'];
$type = $_GET['type'];
$x = 1;
$total = 0;
$grandTotal = '';
$byData = mysqli_query($con,"CALL reportByDate('".$fromDate."','".$toDate."')") or die(mysqli_error($con));
if(mysqli_num_rows($byData)>0)
{
if($type=='all')
{
?>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th class="numeric">Type</th>
<th class="numeric">Token</th>
<th class="numeric" style="width:15%">Patient Name</th>
<th class="numeric">Age</th>
<th class="numeric">Gender</th>
<th class="numeric" style="width:12%">Refferred By</th>
<th class="numeric" style="width:15%">Reff. By Address</th>
<th class="numeric" style="width:13%">Purpose of visit</th>
<th class="numeric">Amount</th>
<th class="numeric" style="width:12%">Date</th>
<th class="numeric">Time</th>
<th class="numeric">Status</th>
</tr>
</thead>
<?php
while($byDataResult = mysqli_fetch_assoc($byData))
{
$total = $total+$byDataResult['Amount'];
?>
<tr>
<td><?php echo $x; ?></td>
<td><?php echo $byDataResult['ScanType']; ?></td>
<td><?php echo $byDataResult['TokenYesterday']."/".$byDataResult['TokenToday'] ?></td>
<td class="numeric"><?php echo $byDataResult['PatientName']; ?></td>
<td class="numeric"><?php echo $byDataResult['Age']; ?></td>
<td class="numeric"><?php echo $byDataResult['Sex']; ?></td>
<td class="numeric"><?php echo $byDataResult['RefferredBy']; ?></td>
<td class="numeric"><?php echo $byDataResult['ReffByAddress']; ?></td>
<td class="numeric" style="width: 300px;"><?php echo substr($byDataResult['PurposeOfvisit'],0,100); ?></td>
<td class="numeric"><?php echo number_format($byDataResult['Amount'],2); ; ?></td>
<td class="numeric"><?php echo $byDataResult['Date']; ?></td>
<td class="numeric"><?php echo $byDataResult['created_at']; ?></td>
<td class="numeric" style="color: red;text-align: center;">
<?php
if( $byDataResult['Status']==2)
{
echo 'Edited';
}
else{
echo "---";
}
?></td>
</tr>
<?php
$x++;
}
?>
<tr class="totalRow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th style="text-align: right;">Total</th>
<th><?php echo number_format($total,2); ?>/-</th>
<th></th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
<?php
}
else{
$x = 1;
$total = 0;
$grandTotal = '';
$byDataType = mysqli_query($con,"CALL reportByDateType('".$fromDate."','".$toDate."','".$type."')") or die(mysqli_error($con));
if(mysqli_num_rows($byDataType)>0){
?>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th class="numeric">Type</th>
<th class="numeric">Token</th>
<th class="numeric" style="width:15%">Patient Name</th>
<th class="numeric">Age</th>
<th class="numeric">Gender</th>
<th class="numeric" style="width:12%">Refferred By</th>
<th class="numeric" style="width:15%">Reff. By Address</th>
<th class="numeric" style="width:13%">Purpose of visit</th>
<th class="numeric">Amount</th>
<th class="numeric" style="width:12%">Date</th>
<th class="numeric">Time</th>
<th class="numeric">Status</th>
</tr>
</thead>
<?php
while($byDataResults = mysqli_fetch_assoc($byDataType))
{
$total = $total+$byDataResults['Amount'];
?>
<tr>
<td><?php echo $x; ?></td>
<td><?php echo $byDataResults['ScanType']; ?></td>
<td><?php echo $byDataResults['TokenYesterday']."/".$byDataResults['TokenToday'] ?></td>
<td class="numeric"><?php echo $byDataResults['PatientName']; ?></td>
<td class="numeric"><?php echo $byDataResults['Age']; ?></td>
<td class="numeric"><?php echo $byDataResults['Sex']; ?></td>
<td class="numeric"><?php echo $byDataResults['RefferredBy']; ?></td>
<td class="numeric"><?php echo $byDataResults['ReffByAddress']; ?></td>
<td class="numeric"><?php echo substr($byDataResults['PurposeOfvisit'],0,100); ?></td>
<td class="numeric"><?php echo number_format($byDataResults['Amount'],2); ; ?></td>
<td class="numeric"><?php echo $byDataResults['Date']; ?></td>
<td class="numeric"><?php echo $byDataResults['created_at']; ?></td>
<td class="numeric" style="color: red;text-align: center;">
<?php
if( $byDataResults['Status']==2)
{
echo 'Edited';
}
else{
echo "---";
}
?></td>
</tr>
<?php
$x++;
}
?>
<tr class="totalRow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th style="text-align: right;">Total</th>
<th><?php echo number_format($total,2); ?>/-</th>
<th></th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
<?php
}
else{
?>
<h3 style="text-align: center">Sorry! No Record Found</h3>
<?php
}
}
}
else{
?>
<h3 style="text-align: center">Sorry! No Record Found</h3>
<?php
}
?>
Hope it will help You :)
function fetch_project_data_filtered() {
$("#user_ids").change(function(){
var assign_to = $(this).val();
var dataString = "assign_to="+assign_to;
//alert(assign_to);
$.ajax({
type: "POST",
url: "x-fetch.php",
data: dataString,
dataType:"json",
success: function(data)
{
for(var count=0; count<data.length; count++)
{
var html_data = '<tr><td>'+data[count].project_id+'</td>';
html_data += '<td data-name="project_name" class="project_name" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].project_name+'</td>';
html_data += '<td data-name="created_on" class="created_on" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].created_on+'</td>';
html_data += '<td data-name="target_date" class="target_date" data-type="date" data-pk="'+data[count].project_id+'">'+data[count].target_date+'</td>';
html_data += '<td data-name="assign_to" class="assign_to" data-type="text" data-pk="'+data[count].project_id+'">'+data[count].assign_to+'</td>';
html_data += '<td data-name="current_status" class="current_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].current_status+'</td>';
html_data += '<td data-name="previous_status" class="previous_status" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].previous_status+'</td>';
html_data += '<td data-name="cito_comment" class="cito_comment" data-type="textarea" data-pk="'+data[count].project_id+'">'+data[count].cito_comment+'</td>';
$('#project_data').empty().html(html_data);
}
}
});
});
}
Use
$('#project_data').html(html_data)
instead of
$('#project_data').append(html_data)
in your change script.
I am little confused in making one function in my PHP page. Actually I want make one function which can transfer value from Filed A to filed B.
My current code is like below
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>S.No.</th>
<th>Profile</th>
<th>Username</th>
<th>Email</th>
<th>Name</th>
<th>Mobile</th>
<th>Requested Credit</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if(mysqli_num_rows($result) > 0) { ?>
<?php $s=1; while($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $s;?></td>
<td><img class="img-thumbnail" style="height:50px;width:50px;" src="<?php echo $row['user_image']; ?>" alt="userimg" ></td>
<td><?php echo $row['username']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['mobile']; ?></td>
<td><?php echo $row['request_redeem']; ?></td>
<td> <button onClick="reply(<?php echo $row['user_id'];?>);" class="btn btn-xs " type="button" ><i aria-hidden="true" class="fa fa-thumbs-down"> Approve</i></button> </td>
</tr>
<?php $s++; } ?>
<?php } ?>
</tbody>
in this request_redeem is value which I want transfer in filed called Credit. Both filed is in same database table. Can anyone please suggest me what should I do for it ? I am newbie and learning PHP yet...so Please let go my foolish questions if you think. Thanks
You should call $.ajax function on click on button.Like this:
$.ajax({ url: '/my/site',
data: {action: 'test'},
type: 'post',
success: function(output) {
alert(output);
}
});
Through ajax function on given url, you can create function there and update value in that function and return response that would update value in above view.
Manish has given good example for sending the ajax request . You write a SQL query on the request url to update those values.
I have searched for hours now to find out how I could do this, but unfortunately all to no avail.
I am trying to send entered information so it can run through MySQL and obtain the information, then echo it in table on screen.
The issue (as far as I can tell) must be with my JQuery code:
$("#btnCheckNoteIDs").click(function(){
var noteUser = $("#noteUser").val();
var noteDate = $("#noteDate").val();
$("#LoadNoteIDs").load('check_noteIDs.php?noteDate='+noteDate + "¬eUser="+noteUser);
});
My php code is as follows:
$result = mysqli_query($con,"
SELECT ID, ClientID, Note, ToDoDate, CaseID
FROM ToDoNotes
WHERE ToDoStatus='0' and Deleted='0' and `ToDoDate`='".$_GET['noteIDsDate']."' and User='".$_GET['noteIDsDate']."'");
while($row = mysqli_fetch_array($result))
{
$ID = $row['ID'];
$ClientID = $row['ClientID'];
$Note = $row['Note'];
$ToDoDate = $row['ToDoDate'];
$CaseID = $row['CaseID'];
}
?>
<table class="table table-striped">
<thead>
<tr>
<th>Note ID</th>
<th>Client ID</th>
<th>Case ID</th>
<th>Note</th>
<th>To Do Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><? echo $noteID; ?></td>
<td><? echo $ClientID; ?></td>
<td><? echo $CaseID; ?></td>
<td><? echo $Note; ?></td>
<td><? echo $ToDoDate; ?></td>
</tr>
</tbody>
</table>
Can anyone here offer any assistance please? Any help will be greatly appreciated!
Thanks!
Suppose you have form.php like below:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form method="post" id="btnCheckNoteIDs">
<label> User</label>
<input type="text" name="user" id="noteUser"><br>
<label>Date</label>
<input type="date" name="date" id="noteDate"><br>
<input type="submit" value="submit">
</form>
<br>
<div id="LoadNoteIDs"></div>
</body>
</html>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script>
$(document ).ready(function() { //make sure document is ready
$('#btnCheckNoteIDs').submit(function(e){
e.preventDefault();//to prevent default behaviour
var noteUser = $("#noteUser").val();
var noteDate = $("#noteDate").val();
if(noteUser==undefined){
alert('No noteuser');
return false;
}else if(noteDate==undefined){
alert('no note date');
return false;//stop sending
}
//to convert %2F, use decodeURIComponent
var param= 'noteDate='+decodeURIComponent(noteDate) + '¬eUser='+noteUser;
$.ajax({
url: "check_noteIDs.php",
data: param,
type: "post",
success: function(data){
$('#LoadNoteIDs').html(data);
}
});
});
});
</script>
in check_noteIDs.php which must be in the same folder where you put the form.php
require_once "dbconfig.php";
$user= isset($_REQUEST['noteUser'])? $_REQUEST['noteUser']:'';
$date = isset($_REQUEST['noteDate'])? date('Y-m-d', strototime($_REQUEST['noteDate'])):'';
//You can validate here.
$result = mysqli_query($con," SELECT ID, ClientID, Note,
ToDoDate, CaseID
FROM `ToDoNotes`
WHERE `ToDoStatus`='0' AND `Deleted`='0'
AND `ToDoDate`='$date'
AND `User`='$user'");
$row = mysqli_fetch_assoc($result);
<table class="table table-striped">
<thead>
<tr>
<th>Note ID</th>
<th>Client ID</th>
<th>Case ID</th>
<th>Note</th>
<th>To Do Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $row['ID']; ?></td>
<td><?php echo $row['ClientID']; ?></td>
<td><?php echo $row['CaseID']; ?></td>
<td><?php echo $row['Note']; ?></td>
<td><?php echo $row['ToDoDate']; ?></td>
</tr>
</tbody>
</table>
<?php
mysqli_free_result($result);
mysqli_close($con);
?>
I think your issue is the submit button in your form, submits the form before the script executes. If that's the case, you need to update your script as below:
$("#btnCheckNoteIDs").click(function(event){
event.preventDefault();
var noteUser = $("#noteUser").val();
var noteDate = $("#noteDate").val();
$("#LoadNoteIDs").load('check_noteIDs.php?noteDate='+noteDate + "¬eUser="+noteUser);
});