Tutorial :Jquery: ajaxComplete wont get the response



Question:

Hi :) When using Firebug i can see it returns 0 or 1, so the php is ok. But seems like ajax server_reponse isnt getting it.. somehow. Anyone see the problem?

j.ajax({      type: "POST",      url: "php/inc/ajax_check_username.php",      data: "username=" + username,      success: function (server_response) {            j("#availability_status").ajaxComplete(function (event, request) {              if (server_response == '0') {                  alert('ledig..');                  j("#availability_status").html('<p>Ok 0</p> <font color="Green"> Ledig! </font>');              } else if (server_response == '1') {                  alert('IKKE ledig..');                  j("#availability_status").html('<p>Ok 1</p> <font color="red">Ikke Ledig... </font>');              }            });      } // server resp  });  


Solution:1

have you tried just this

j.ajax({      type: "POST",      url: "php/inc/ajax_check_username.php",      data: "username=" + username,      success: function (server_response) {                   if (server_response == '0') {                  alert('ledig..');                  j("#availability_status").html('<p>Ok 0</p> <font color="Green"> Ledig! </font>');              } else if (server_response == '1') {                  alert('IKKE ledig..');                  j("#availability_status").html('<p>Ok 1</p> <font color="red">Ikke Ledig... </font>');              }            } // server resp  });  

and what are the possible response from server? just '0' or '1'?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »