havenpets Posted May 22, 2010 Share Posted May 22, 2010 Okay, so I am creating a Jquery registration page using "dialog". I am using the "jquery" version of AJAX. It's pretty similar, and the problem I am having can happen to either. Basically this is how my code is organized: function go_ajax(formtype){ formvalue = document.getElementById(formtype).value; $.get("/xatron/check.php?type="+formtype+"&value="+escape(formvalue), function(data) { // TEST alert(data); return data; }); } Data = httpObject.responseText Thats the same as a "get" script in AJAX. Now, later in my code I have... if(go_ajax('username') == 0){ // Fail }else{ // Pass } Now, it will come up as "Pass" EVERYTIME because... go_ajax('username') = undefined. But when I do the test and do the alert above it presents to me, 0 or 1. x_X And it alerts AFTER undefined alerts. How would I go about fixing this? Anyone know? (p.s. YES, I know this is jquery BUT ajax is the exact same problem (i've tried both methods). Thank you, Matt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.