hello friends may peace on you !
I have a little problem in my code.i want display the fetch value from db in a textfield after pressing load button.i am using ajax post method for it but cant figure it out what the problem.please help me !
Thanks,
Index.php
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="ajax.js"></script>
</head>
<body>
<input type="text" id="name" />
<input type="submit" value="load" id="submit" />
</body>
</html>
test.php
<?php
if(isset($_POST))
{
mysql_connect("localhost","root","");
mysql_select_db("project");
$sql = mysql_query("SELECT `class_name` FROM `classes` WHERE `id` = '316'");
while($test = mysql_fetch_assoc($sql))
{
echo $show = $test['class_name'];
}
}
?>
$(document).ready(function(){
$("#submit").click(function(){
function show(post){
$.post('[B]test.php[/B]', {post:post}, function(data){
$("#name").html(data) });
}
show($("#name").val());
});
});