Almost, the problem is always  "check1 is not defined"

Example:

      function checked(check) {
        this.check = check
        }

     $("#ajax").ajaxForm({
        success:
            function(data) {
                  check1 = new checked(data)
                  // do stuff with data;
              }
        });

      $("#target").ajaxSuccess(function(request, settings){
         $(function() {
             if (check1 == "something") {
             $(this).append(check1);
             }
        })
        });

Ideas how can I fix "check1 is not defined"?

Regards

Mario Moura

2007/12/14, Mario Moura <[EMAIL PROTECTED]>:
>
>   Wow, thanks a lot Richard
>
> I can do this with php (quite simple) but I am lost with Jquery /
> Javascript syntax. Could you help me?
>
> Example
>
>      $("#mychild").ajaxForm({
>         success:
>             function(data) {
>                   // do stuff with data;
>                 function toCheck() {
>                     $(data);
>                 }
>             }
>         });
>
>         // So for each Ajax request I will insert
>             function toCheck() {
>                 $(data);  // or I can get some data into $data like
> $(data).attr("myid")
>             }
>
>         // So I want check if toCheck() have a value or not but I will let
> simple, just alert me.
>         // I dont know if the syntax is ok
>
>             function pleaseAlertMe() {
>                 alert(toCheck());
>             }
>
>             I dont want (or I cant) pass the $(data) to a div and check
> there by DOM I prefer check by function. If is it possible of course.
>
>             And now I will study a lot of JavaScript Syntax. ;)
>
> Regards
>
> Mario Moura
>
> 2007/12/14, Richard D. Worth < [EMAIL PROTECTED]>:
> >
> > You could declare a function and give it a name, instead of using an
> > anonymous function, then pass that as the success function for each ajax
> > call.
> >
> > - Richard
> >
> > On Dec 14, 2007 8:51 AM, Mario Moura < [EMAIL PROTECTED]> wrote:
> >
> > > No.
> > >
> > > Let me explain better.
> > >
> > > In your scenario you made a individual AJAX request and into this
> > > request you create rules.
> > >
> > > But JQuery  could create an universal AjaxSucess to test all data from
> > > all ajax requests.
> > >
> > > So imagine this scenario:
> > >
> > > The page have a lot of AJAX requests, something like ajaxform, $.ajax,
> > > $.post, $.get
> > >
> > > So from response of each AJAX we could create a function like: (and I
> > > will use switch)
> > >
> > >
> > > $().ajaxSuccess (function() {
> > >          switch( $(data).attr("id")  ) { // here I get the data from
> > > AJAX Sucess every time happen could by by xml, json but I am using div
> > >             case 'myid':
> > >                 // do stuff with data;
> > >             break;
> > >             case 'myid2':
> > >                // do stuff with data;
> > >             break;
> > >          }
> > >
> > > no matter if it is from $.ajax({"type": "POST",  "url": " foo1.php",}); 
> > > or  $.ajax({"type": "POST", "url": "
> > > foo2.php "}); or $.ajax({"type": "POST", "url": "foo3.php ",});
> > >
> > > But at this moment. I think is not possible. But could be a good
> > > improve.
> > >
> > > Did you understand?
> > >
> > > Regards
> > >
> > > Mario Moura
> > >
> > > 2007/12/14, Giovanni Battista Lenoci < [EMAIL PROTECTED]>:
> > >
> > > >
> > > > Don't know if I understood,
> > > >
> > > >    $.ajax({"type": "POST",
> > > >       "url": " foo2.php",
> > > >       "data": data,
> > > >       "dataType": "json",
> > > >       "success": function(server_response) {
> > > >           switch(server_response.wich_function) {
> > > >              case '1':
> > > >                 on_success_one(server_response);
> > > >              break;
> > > >              case '2':
> > > >                 on_success_two(server_response);
> > > >              break;
> > > >           }
> > > >
> > > >       });
> > > >
> > > >
> > >
> > >
> > > --
> > > Mário Alberto Chaves Moura
> > > [EMAIL PROTECTED]
> > > 31-3264-6203
> > > 31-9157-6000
> >
> >
> >
>
>
> --
> Mário Alberto Chaves Moura
> [EMAIL PROTECTED]
> 31-3264-6203
> 31-9157-6000
>



-- 
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-3264-6203
31-9157-6000

Reply via email to