Jump to content

FastPHP

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

FastPHP's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah, I did. Here's my new code. jQuery: $(document).ready(function(){ // Declare click variable var u_click = false; //If username focused, funciton: $("#username").focus(function() { //If not clicked yet, function: if (u_click == false) { //Set clicked to true and clear field u_click = true; $("#username").val(""); } }); //Username check for length function $("#username").keyup(function() { //Send variable $.get("../php/checkuser.php", {username: $("#username").val()}, function (data) { if (data == true) { $("#usernameMessage").html("Right"); } else { $("#usernameMessage").html("Wrong"); } }); }); }); PHP: <?php //Check if there is a get variable if(isset($_GET['username'])) { $username = $_GET['username']; //Get string length $length = strlen($username); //Check length if ($length < 8 && $length > 3) echo true; else echo false; } ?> Note: I tried with both boolean and string.
  2. I have done exactly what you said...still nothing. Sorry!
  3. Gah, no. It's local at the moment, and good thing, too. But here's the HTML, jQuery, and PHP (cropped). HTML: <label>Desired Username:</label> <input id="username" type="text" name="username" /> <span id="usernameMessage"></span> <br /> <div id="spacer"></div> jQuery: $(document).ready(function(){ // Declare click variable var u_click = false; //If username focused, funciton: $("#username").focus(function() { //If not clicked yet, function: if (u_click == false) { //Set clicked to true and clear field u_click = true; $("#username").val(""); } }); //Username check for length function $("#username").keyup(function() { //Send variable $.get("../php/checkuser.php", {username: $("#username").val()}, function (data) { if (data == "true") { $("#usernameMessage").innerHTML = "Right"; } else { $("#usernameMessage").innerHTML = "Wrong"; } }); }); }); <?php //Check if there is a get variable if(isset($_GET['username'])) { $username = $_GET['username']; //Get string length $length = strlen($username); //Check length if ($length < 8 && $length > 3) print "true"; else print "false"; } ?> I think it might be $("#usernameMessage").innerHTML = "Right"; because I've had problems with innerHTML before. Not sure...
  4. I changed it to a string, still doesn't work (read above)? Ahh!
  5. Yes, I have checked multiple times on the path. Thanks for the suggestion though. And what do you mean?? Edit: modified and still didn't work. New PHP: //Check length if ($length < 8 && $length > 3) print "true"; else print "false"; New jQuery: if (data == "true")
  6. I have absolutely no idea why this isn't working. Here's the PHP file: //Check if there is a get variable if(isset($_GET['username'])) { $username = $_GET['username']; //Get string length $length = strlen($username); //Check length if ($length < 8 && $length > 3) print true; else print false; } Here's the jQuery: $(document).ready(function(){ // Declare click variable var u_click = false; //If username focused, funciton: $("#username").focus(function() { //If not clicked yet, function: if (u_click == false) { //Set clicked to true and clear field u_click = true; $("#username").val(""); } }); //Username check for length function $("#username").keyup(function() { //Send variable $.get("../php/checkuser.php", {username: $("#username").val()}, function (data) { if (data == true) { $("#usernameMessage").innerHTML = "Right"; } else { $("#usernameMessage").innerHTML = "Wrong"; } }); }); }); This first jQuery function meant to clear the form works 100%, but the other doesn't return anything at all in the span with ID "usernameMessage". Why is this...any help? Thanks! Oh, and hi! XD
×
×
  • 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.