ajax / JS / what ever tut request :p
ajax / JS / what ever tut request :p
Halls or some1 else with abit of experience...
could you by any chance post up a quick tut that checks the availablility of a username when it is typed into a box (so it checks it live), rather than filling out the form and then finding out when you submit that its not availiable.
hope that makes sense lol.... cant think of any other way to describe it XD
<3
could you by any chance post up a quick tut that checks the availablility of a username when it is typed into a box (so it checks it live), rather than filling out the form and then finding out when you submit that its not availiable.
hope that makes sense lol.... cant think of any other way to describe it XD
<3
New Site Coming Soon! Stay tuned 

- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: ajax / JS / what ever tut request :p
yeah give me a couple hours
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: ajax / JS / what ever tut request :p
Thats actually a really good idea...cant wait too see it...
would make much more sense and easier as well!
would make much more sense and easier as well!
Re: ajax / JS / what ever tut request :p
even just the script will do with a quick ass write up of wht does wht
x
x
New Site Coming Soon! Stay tuned 

- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: ajax / JS / what ever tut request :p
sorry about the delay on this. This is a bit harder than expected. The way I had planned works but it is not pretty or the best way to do it.
Here is an example of how it should be done but you have to use jquery and it is a tad complicated
http://roshanbh.com.np/2008/04/check-us ... query.html
i will work on a easier way
Here is an example of how it should be done but you have to use jquery and it is a tad complicated
http://roshanbh.com.np/2008/04/check-us ... query.html
i will work on a easier way
Re: ajax / JS / what ever tut request :p
so is this jquery lark preinstalled into servers or u need to download a page of scripts or summert?
i have neva used ajax / javascript / fancy stuff before lol.
i have neva used ajax / javascript / fancy stuff before lol.
New Site Coming Soon! Stay tuned 

- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: ajax / JS / what ever tut request :p

- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: ajax / JS / what ever tut request :p
k have to double post
here is a hint what i have so far
make a form called userform
then name the username section username
then onchange=(checkusername())
here is your ajax request
then you would have to make a php page called checkname
all we need to do now is make ajax send the print out back to the first page and place it in a document id
as you can see even with me simplifying it, it is a bit difficult without having some time. But I am almost there.
Ajax will run the checkname.php in the background(on the server) so the page will never change
here is a hint what i have so far
make a form called userform
then name the username section username
then onchange=(checkusername())
here is your ajax request
Code: Select all
function checkusername()
{
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
}}
var namecheck = document.userform.username.text;
ajaxRequest.open("GET", "checkname.php?username=" + namecheck, true);
ajaxRequest.send(null);
}
Code: Select all
<?php
include_once'connect.php';
$username=$_GET['username'];
$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array($isplayer2);
if($isplayer3)
{
print "There is already a player of that name";
}
?>
as you can see even with me simplifying it, it is a bit difficult without having some time. But I am almost there.
Ajax will run the checkname.php in the background(on the server) so the page will never change
Re: ajax / JS / what ever tut request :p
ok....
hmmm....
yeah.... lol
ok so the form 'userform' is wrapped round the whole registration form i take it?
then onchange goes into the text field box?
guh this is all too confusing XD
looking forward to the final result tbh lol
hmmm....
yeah.... lol
ok so the form 'userform' is wrapped round the whole registration form i take it?
then onchange goes into the text field box?
guh this is all too confusing XD
looking forward to the final result tbh lol
New Site Coming Soon! Stay tuned 

- Lord Strife
- Posts: 104
- Joined: Wed Oct 28, 2009 3:10 pm
Re: ajax / JS / what ever tut request :p
If someone is still interested in this I can post a tutorial on how to implement it