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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.