php Ajax jquery check -


hi every body testing code checking name availability ajax , dont why doesnt work

<head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="jquery.js"></script> <link href="style.css" rel="stylesheet" type="text/css"  /> <title>index</title>  </head> 

this body , jquery function
check

<div id="answer" >   <script type="text/javascript"> //script $(document).ready(function() {     $("#checkme").click(function(){     $("#answer").ajaxstart(function() {         $(this).text("loading .. .").show("slow");     });     var userme = $("#username").val();     $.ajax({         type:get,         url:"file.php",         data:"username=" + userme,         success: function(msg){ $("#answer").text(msg).fadein("slow");}     });       }); }); </script> </div></form> </body> </html> 

and php code

    <?php $names = array (a,b,c,d); $username = $_get['username'];  if(in_array ($username , $names)){      echo "ok";      }else{           echo "doesnt exist ";           }  ?> 

plz help

im new jquery , ajax , cant guess mistake hope can me

it's unclear problem can see multiple errors.

in javascript code:

type:get should type: "get"

data:"username=" + userme should data: {username: userme}

in php code:

$names = array (a,b,c,d); should $names = array ("a", "b", "c", "d");


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -