Jump to content

simple question about sajax


vbnullchar

Recommended Posts

hi im learning sajax and i cant get this code to work, can you tell whats wrong

 

<?
include('includes/Sajax.php');
include('sources/class.mysql.php');

$mysql = new cMysql();

function _check_username($name) {
	global $mysql;
	$sql="select username from employees where username='$name'";
	return $mysql->num_rows($sql);
}

sajax_init();
$sajax_debug_mode = 1;
sajax_export("_check_username");
sajax_handle_client_request();

?>
<script>
<?
sajax_show_javascript();
?>
function do_show_result(result) {
	document.getElementById("result").value = result;
}

function do_check_username() {
	var username;
	username=document.getElementById("uname").value;
	x__check_username(username,do_show_result);
}

</script>
<div id="result">aaaa</div>

<form method="POST">
<input type="text" id='uname' > <input type="button" value="check" onclick="do_check_username();return false;" >
</form>

Link to comment
https://forums.phpfreaks.com/topic/45387-simple-question-about-sajax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.