Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem Ajax, cant read value. help!!!!

    when pressing submit button, didnt show anythg in span status. it shud b change 'zzz' to 'check availability', after that either show 'availability' or other msg from my php file, but it juz show till 'check availability' and bck to 'zzzz', so is there any error?? pls help me!!!!

    Code:
    $(document).ready(function(){
    		$("#submit").click(function()
    			{
    				
    				var noIC = $("#noIC").val();
    				var password = $("#password").val();
    				var msgbox = $("#status");
    				
    				msgbox.html('Checking availability');
    				
    				
    				$.ajax({
    					   type: "POST",
    					   url: "loginphp.php",
    					   data: "noIC=" + noIC,
    					   success: function(msg){
    						   alert(msg);
    						  
    						   $("#status").ajaxComplete(function(event, request){
    															  
    						   if(msg == "OK"){
    							   alert('Handler for .click() called.');
    							   msgbox.html('availability') 
    							   			}
    							   //$(document.location = "order1.html");
    						  else{
    							   alert('Handler for .click() called.');
    							   msgbox.html(msg);}
    						   
    										 					 });
    					   }
    						  
    					  });
    									});
    						   });
    					   
    </script>				
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="">
      <p>
        <label>IC    
          <input type="text" name="noIC" id="noIC" />
        </label>
      </p>
      <p>
        <label>password
          <input type="text" name="password" id="password" />
          <span id="status">zzzz</span>
        </label>
      </p>
      
      <p>
        <label>
          <input type="submit" name="submit" id="submit" value="Submit" />
        </label>
      </p>
    </form>
    Last edited by Kor; 11-25-2011 at 01:23 PM. Reason: moved to the proper Forum and set the proper prefix

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Is this JQuery? Prototype? MooTools? Scriptaculous? Google API? Yahoo API, other?

    If you are using a framework, please specify which framework is that. We are not suppose to guess.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry~ dis is ajax + jquery~


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •