You need to put your entire "if(res.match('true')" block inside the
onComplete function...



On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I've been having some very frustrating issues with Ajax.Request, or
> prehaps its more in line to say that my problem is with my knowledge
> of javascript.  here is what is happening.
>
> I am using a windowed login template for our internal site, where
> certain things requires a supervisor password, and clock number, i
> pull these in from our mysql database.  However, my script keeps going
> without waiting for my result to get back.
>
> Here is the page where i got my window template:
>
> http://prototype-window.xilinus.com/
>
> It works great, got it set up fine, I've even edited the code to go
> check to see if my password is valid.  My response page returns either
> "true", or "false", but I get the screenshake and stuff before my
> request is finished, can anyone give me a hand here?
>
> Here is my function.
>
> <code>
> function ReqPW(dept, level)     {
>         var res = '';
>
>         Dialog.confirm($('login').innerHTML,
>                                   {
>                                           className:"alphacube",
>                                           width:400,
>                                           okLabel: "login",
>                                           cancelLabel: "cancel",
>                                           onOk:function(win)
>                                           {
>                                                 var clkno = $F('clockno');
>                                                 var pw = $F('pswd');
>                                                 var deptno = dept;
>                                                 var lvl = level;
>                                                 var params = 'ClockNo=' +
> clkno + '&Dept=' + deptno + '&passwd='
> + pw + '&Level=' + lvl;
>                                                 var url =
> '../Processes/leadlogin.lasso?' + params;
>
>                                                 new Ajax.Request(url,
>                                                           {
>                                                                   method:
> 'get',
>                                                                   onComplete:
> function(tryitout)
>                                                                         {
>                                                                               
>   var
> res = tryitout.responseText;
>                                                                         }
>                                                           });
>                                         if(res.match('true'))
>                                                 {
>                                                         return true;
>                                                 }
>                                         else
>                                                 {
>                                                         
> $('login_error_msg').innerHTML='Login
> or password inccorect';
>
>                                                         
> $('login_error_msg').show();
>
> Windows.focusedWindow.updateHeight();
>                                                         new Effect.Shake(
> Windows.focusedWindow.getId());
>                                                         return false;
>                                                 }
>                                           }
>                                 });
>
> }
>
> </code>
>
>
> >
>


-- 
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-955-1457
Blog: http://www.someElement.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to