i pull info from mysql database and display it to the user to see if that time and date is available,
normaly i use just a typical echo to display the results, but as i want to keep it all on the same page so i dont have to do a refresh i am using ajax,
so now my echo is no good,
so how would i put the info on using the success?
iv tried a few things but dident really understand it all that much and failed.
as my php would be,
and my ajax as it standsPHP Code:$data=mysql_query("select * from $tbl_name WHERE dates='$compdate' AND time='$newtimes'");
$row = mysql_fetch_array($data);
$fetched = $row['dates'] . $row['time'];
if ($fetched == "") {
echo "the date: $compdate and time: $newtimes is available<br />";
}else{
echo "the date: $compdate and time: $newtimes is NOT available<br />";
}
the success function i just posted is just from an example so how would i change that to echo what is from the php file?Code:$(document).ready(function(){ $("form#chkreadings").submit(function() { // we want to store the values from the form input box, then send via ajax below var fpeople = $('#people').attr('value'); var flistday = $('#listday').attr('value'); var flistmonth = $('#listmonth').attr('value'); var flisthour = $('#listhour').attr('value'); var flistampm = $('#listampm').attr('value'); $.ajax({ type: "POST", url: "checkreadings.php", data: "people=" + fpeople + "listday=" + flistday + "listmonth=" + flistmonth + "listhour=" + flisthour + "listampm=" + flistampm, success: function(){ $('form#chkreadings').hide(function(){$('div.success').fadeIn();}); } }); return false; }); }); </script>
Thanks



Reply With Quote
Bookmarks