Loading ...
Sorry, an error occurred while loading the content.

Re: Connection manager & executing retuning javascript

Expand Messages
  • antoine_courbot
    ... /(?:
    Message 1 of 12 , Jul 3, 2006
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, Nige White <nigelw@...> wrote:
      >
      > Try this. Response text is in the var resopnseText:
      >
      > var re =
      >
      /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig;

      > // assumes HTML well formed.
      > var match;
      > while (match = re.exec(responseText))
      > {
      > var s0 = document.createElement("script");
      > if (match[1])
      > s0.src = match[1];
      > else if (match[2])
      > s0.text = match[2];
      > else
      > continue;
      >
      document.getElementsByTagName("head")[0].appendChild(s0);
      > }
      >
      >
      > g.gRay wrote:
      >
      > > Boonstra, T.H. (Tim) wrote:
      > >
      > >> Hello everybody,
      > >>
      > >> After i call an ajax call and receive an responseText i want the
      > >> javascript that is contained in the responsText to be executed. I
      > >> tryed using eval() however the result is mostly html with here and
      > >> there some <script>..<script> commands.
      > >>
      > >> Does anybody know how i can execute those parts while leaving the
      > >> html surrounding it intact? Prototype has an building function for
      > >> executing returned javascript but i'm unable to "replicate" the code
      > >> myself.
      > >>
      > >> Thanks in advance.
      > >> Tim Boonstra
      > >>
      > >>
      > >> This e-mail and its contents are subject to the DISCLAIMER at
      > >> http://www.tno.nl/disclaimer/email.html
      > >
      > >
      > > I think you need to use something like this:
      > > aScripts = respXML.getElementsByTagName('script');
      > > for (var i=0; i < aScripts.length; i++){
      > > eval(aScripts[i].innerHTML);
      > > }
      > >
      > > _____________________________________________________________________
      > > This message has been checked for all known viruses. Virus scanning
      > > powered by Messagelabs http://www.messagelabs.com For more information
      > > e-mail : hostmaster@...
      >
      >
      >
      > _____________________________________________________________________
      > This message has been checked for all known viruses. Virus scanning
      > powered by Messagelabs http://www.messagelabs.com For more information
      > e-mail : hostmaster@...
      >

      I have a question. Is there any chance that yahoo develops in a future
      a feature like this one provided by the framework prototype : the
      updater - new Ajax.Updater('mydiv', '/foo/bar', {asynchronous:true,
      evalScripts:true})

      This features allows us to load directly the content of "mydiv" with
      the page /foo/bar and moreover, it avoids us to evaluate scripts like
      mentionned before thanks to the option <b>evalScripts:true</b>.

      So, my question, do you know if Yahoo is going to develop this very
      interesting feature ? (Because Yahoo has a complete framework but this
      feature is very good)

      Thanks.

      Thank you very much.
    • Peter Michaux
      ... I would be very interested to see a higher level connection library that sits on top of the current Yahoo ui connection library. I am sort of developing
      Message 2 of 12 , Jul 3, 2006
      • 0 Attachment
        On 7/3/06, antoine_courbot <antoine_courbot@...> wrote:


        > I have a question. Is there any chance that yahoo develops in a future
        > a feature like this one provided by the framework prototype : the
        > updater - new Ajax.Updater('mydiv', '/foo/bar', {asynchronous:true,
        > evalScripts:true})
        >
        > This features allows us to load directly the content of "mydiv" with
        > the page /foo/bar and moreover, it avoids us to evaluate scripts like
        > mentionned before thanks to the option <b>evalScripts:true</b>.
        >
        > So, my question, do you know if Yahoo is going to develop this very
        > interesting feature ? (Because Yahoo has a complete framework but this
        > feature is very good)

        I would be very interested to see a higher level connection library
        that sits on top of the current Yahoo ui connection library. I am sort
        of developing this as part of a Rails project and wrapping it in Ruby
        helpers. I'd like to see an alternative to prototype and scriptaculous
        appear in the Rails world.

        Peter
      • Joerg Battermann
        Peter, have you made any progress in integration yui (more closely) with Rails and use it instead of prototype/script.aculo.us? -j ... future ... this
        Message 3 of 12 , Aug 24, 2006
        • 0 Attachment
          Peter,

          have you made any progress in integration yui (more closely) with
          Rails and use it instead of prototype/script.aculo.us?

          -j

          --- In ydn-javascript@yahoogroups.com, "Peter Michaux"
          <petermichaux@...> wrote:
          >
          > On 7/3/06, antoine_courbot <antoine_courbot@...> wrote:
          >
          >
          > > I have a question. Is there any chance that yahoo develops in a
          future
          > > a feature like this one provided by the framework prototype : the
          > > updater - new Ajax.Updater('mydiv', '/foo/bar', {asynchronous:true,
          > > evalScripts:true})
          > >
          > > This features allows us to load directly the content of "mydiv" with
          > > the page /foo/bar and moreover, it avoids us to evaluate scripts like
          > > mentionned before thanks to the option <b>evalScripts:true</b>.
          > >
          > > So, my question, do you know if Yahoo is going to develop this very
          > > interesting feature ? (Because Yahoo has a complete framework but
          this
          > > feature is very good)
          >
          > I would be very interested to see a higher level connection library
          > that sits on top of the current Yahoo ui connection library. I am sort
          > of developing this as part of a Rails project and wrapping it in Ruby
          > helpers. I'd like to see an alternative to prototype and scriptaculous
          > appear in the Rails world.
          >
          > Peter
          >
        • Jack Slocum
          Nice timing. I just put out an update this morning to the YAHOO.ext package that includes such a higher level connection library . It facilitates updating of
          Message 4 of 12 , Aug 24, 2006
          • 0 Attachment
            Nice timing. I just put out an update this morning to the YAHOO.ext
            package that includes such a "higher level connection library". It
            facilitates updating of elements similar to the prototype library,
            except built around YAHOO.util.Connect.

            --- In ydn-javascript@yahoogroups.com, "Joerg Battermann" <jb@...>
            wrote:
            >
            > Peter,
            >
            > have you made any progress in integration yui (more closely) with
            > Rails and use it instead of prototype/script.aculo.us?
            >
            > -j
            >
            > --- In ydn-javascript@yahoogroups.com, "Peter Michaux"
            > petermichaux@ wrote:
            > >
            > > On 7/3/06, antoine_courbot antoine_courbot@ wrote:
            > >
            > >
            > > > I have a question. Is there any chance that yahoo develops in a
            > future
            > > > a feature like this one provided by the framework prototype : the
            > > > updater - new Ajax.Updater('mydiv', '/foo/bar',
            {asynchronous:true,
            > > > evalScripts:true})
            > > >
            > > > This features allows us to load directly the content of "mydiv"
            with
            > > > the page /foo/bar and moreover, it avoids us to evaluate scripts
            like
            > > > mentionned before thanks to the option <b>evalScripts:true</b>.
            > > >
            > > > So, my question, do you know if Yahoo is going to develop this
            very
            > > > interesting feature ? (Because Yahoo has a complete framework but
            > this
            > > > feature is very good)
            > >
            > > I would be very interested to see a higher level connection library
            > > that sits on top of the current Yahoo ui connection library. I am
            sort
            > > of developing this as part of a Rails project and wrapping it in
            Ruby
            > > helpers. I'd like to see an alternative to prototype and
            scriptaculous
            > > appear in the Rails world.
            > >
            > > Peter
            > >
            >
          • xxx20ozxxx
            Hi Jack, I haven t had a chance to check out your extensions package, it sounds interesting from looking at your blog. Does your higher level connection
            Message 5 of 12 , Aug 24, 2006
            • 0 Attachment
              Hi Jack,

              I haven't had a chance to check out your extensions package, it sounds
              interesting from looking at your blog.

              Does your "higher level connection library" have the ability to parse
              javascript in returned html? Right now I'm just returning pure
              javascript and evaling it as part of my callback ie:

              var callback =
              {
              success: function(o) { eval(o.responseText);},
              failure: function(o) { alert('failed!'); }
              };

              but of course this only works for pure javascript. So far it hasn't
              been a problem but I'm early into the development of my app and
              already have used this as a work around to returning html with
              embedded javascript.

              --- In ydn-javascript@yahoogroups.com, "Jack Slocum" <jvs308@...> wrote:
              >
              >
              > Nice timing. I just put out an update this morning to the YAHOO.ext
              > package that includes such a "higher level connection library". It
              > facilitates updating of elements similar to the prototype library,
              > except built around YAHOO.util.Connect.
              >
              > --- In ydn-javascript@yahoogroups.com, "Joerg Battermann" <jb@>
              > wrote:
              > >
              > > Peter,
              > >
              > > have you made any progress in integration yui (more closely) with
              > > Rails and use it instead of prototype/script.aculo.us?
              > >
              > > -j
              > >
              > > --- In ydn-javascript@yahoogroups.com, "Peter Michaux"
              > > petermichaux@ wrote:
              > > >
              > > > On 7/3/06, antoine_courbot antoine_courbot@ wrote:
              > > >
              > > >
              > > > > I have a question. Is there any chance that yahoo develops in a
              > > future
              > > > > a feature like this one provided by the framework prototype : the
              > > > > updater - new Ajax.Updater('mydiv', '/foo/bar',
              > {asynchronous:true,
              > > > > evalScripts:true})
              > > > >
              > > > > This features allows us to load directly the content of "mydiv"
              > with
              > > > > the page /foo/bar and moreover, it avoids us to evaluate scripts
              > like
              > > > > mentionned before thanks to the option <b>evalScripts:true</b>.
              > > > >
              > > > > So, my question, do you know if Yahoo is going to develop this
              > very
              > > > > interesting feature ? (Because Yahoo has a complete framework but
              > > this
              > > > > feature is very good)
              > > >
              > > > I would be very interested to see a higher level connection library
              > > > that sits on top of the current Yahoo ui connection library. I am
              > sort
              > > > of developing this as part of a Rails project and wrapping it in
              > Ruby
              > > > helpers. I'd like to see an alternative to prototype and
              > scriptaculous
              > > > appear in the Rails world.
              > > >
              > > > Peter
              > > >
              > >
              >
            • osirishinzen
              I would just like to correct the regular expression. I m no regexp guru so it took me a while to find out what was wrong. Notice that in the last expression
              Message 6 of 12 , Nov 15, 2006
              • 0 Attachment
                I would just like to correct the regular expression.
                I'm no regexp guru so it took me a while to find out what was wrong.
                Notice that in the last expression the "s" in script was escaped with
                "\", for clarify here is the regexp that worked for me.

                /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig;

                --- In ydn-javascript@yahoogroups.com, Nige White <nigelw@...> wrote:
                >
                > Try this. Response text is in the var resopnseText:
                >
                > var re =
                >
                /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig;

                > // assumes HTML well formed.
                > var match;
                > while (match = re.exec(responseText))
                > {
                > var s0 = document.createElement("script");
                > if (match[1])
                > s0.src = match[1];
                > else if (match[2])
                > s0.text = match[2];
                > else
                > continue;
                >
                document.getElementsByTagName("head")[0].appendChild(s0);
                > }
                >
                >
                > g.gRay wrote:
                >
                > > Boonstra, T.H. (Tim) wrote:
                > >
                > >> Hello everybody,
                > >>
                > >> After i call an ajax call and receive an responseText i want the
                > >> javascript that is contained in the responsText to be executed. I
                > >> tryed using eval() however the result is mostly html with here and
                > >> there some <script>..<script> commands.
                > >>
                > >> Does anybody know how i can execute those parts while leaving the
                > >> html surrounding it intact? Prototype has an building function for
                > >> executing returned javascript but i'm unable to "replicate" the code
                > >> myself.
                > >>
                > >> Thanks in advance.
                > >> Tim Boonstra
                > >>
                > >>
                > >> This e-mail and its contents are subject to the DISCLAIMER at
                > >> http://www.tno.nl/disclaimer/email.html
                > >
                > >
                > > I think you need to use something like this:
                > > aScripts = respXML.getElementsByTagName('script');
                > > for (var i=0; i < aScripts.length; i++){
                > > eval(aScripts[i].innerHTML);
                > > }
                > >
                > > _____________________________________________________________________
                > > This message has been checked for all known viruses. Virus scanning
                > > powered by Messagelabs http://www.messagelabs.com For more information
                > > e-mail : hostmaster@...
                >
                >
                >
                > _____________________________________________________________________
                > This message has been checked for all known viruses. Virus scanning
                > powered by Messagelabs http://www.messagelabs.com For more information
                > e-mail : hostmaster@...
                >
              • Andrei Neculau
                Read this post on my blog http://andreineculau.wordpress.com/2006/09/29/ajax-ondemand-javascript-or-dynamic-script-tags/ I have a pretty neat thing going on
                Message 7 of 12 , Nov 18, 2006
                • 0 Attachment
                  Read this post on my blog

                  http://andreineculau.wordpress.com/2006/09/29/ajax-ondemand-javascript-or-dynamic-script-tags/

                  I have a pretty neat thing going on there. The thing is that when you
                  have SCRIPT blocks that load external JavaScript, they get blocked. My
                  solution eliminates that.
                Your message has been successfully submitted and would be delivered to recipients shortly.