i'm trying coding some ajax coding that when user enter their name then click submit, all the data that related with them will be display without refreshing page. But my problem is my code doesn't work(don't show output). can i know what the problem is and maybe give me some solution/example thanks.
below is my code:
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#display").click(function() {
$.ajax({ //create an ajax request to load_page.php
type: "POST",
url: "tesz2.php",
dataType: "html", //expect html to be returned
success: function(response){
$("#responsecontainer").html(response);
//alert(response);
}
});
});
});
</script>
<body>
<form method = Post onclick="display">
<input type ="text" id='name'><br>
<input type='submit'>
</form>
<h3 align="center">Manage Student Details</h3>
<div id="responsecontainer" align="center"></div>
</body>
Php File:
<?php
include("co.php");
mysql_select_db("testing",$con);
$result=mysql_query("select * from Login where user_name='".$_POST['name']."'",$con);
echo "<table border='1' >
<tr>
<td align=center> <b>user Id No</b></td>
<td align=center><b>Name</b></td>
<td align=center><b>Password</b></td>
<td align=center><b>responsibility</b></td></td>";
while($data = mysql_fetch_row($result))
{
echo "<tr>";
echo "<td align=center>$data[0]</td>";
echo "<td align=center>$data[1]</td>";
echo "<td align=center>$data[2]</td>";
echo "<td align=center>$data[3]</td>";
echo "</tr>";
}
echo "</table>";
?>
co.php is my config.file