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

Re: Get Utility with offline server

Expand Messages
  • dietrich.frank
    ... In many cases the callback is defined with inline-functions for success and failure. then it s easy to forget the colon. You re calling the same function
    Message 1 of 15 , Mar 3, 2008
    • 0 Attachment
      >
      > I'm not sure I follow what you are saying...
      > Here is my function:...

      In many cases the callback is defined with inline-functions for success
      and failure. then it's easy to forget the colon.

      You're calling the same function for Success and failure. try some
      simple alert()-things for the failure and see if it arrives (it
      should). then go on and try to find the reason for not seing it in Your
      method.
    • shepmaster
      ... I have tried: var cb = { onSuccess: function() { alert( success ); }, onFailure: function() { alert( failure ); } }; var objTransaction =
      Message 2 of 15 , Mar 4, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "dietrich.frank"
        <fdietrich@...> wrote:

        > In many cases the callback is defined with inline-functions for success
        > and failure. then it's easy to forget the colon.
        >
        > You're calling the same function for Success and failure. try some
        > simple alert()-things for the failure and see if it arrives (it
        > should). then go on and try to find the reason for not seing it in Your
        > method.
        >

        I have tried:

        var cb = {
        onSuccess: function() {
        alert("success");
        },

        onFailure: function() {
        alert("failure");
        }
        };

        var objTransaction =
        YAHOO.util.Get.script("http://127.0.0.1:5555/nope.js", cb);

        And neither alert gets called. Could *you* try the same thing and let
        me know if either alert is called?
      • dietrich.frank
        ... Sorry, I completely overlooked that You are not doing an async-request but util.Get.script which I never worked with. I just tried, but all I get is errors
        Message 3 of 15 , Mar 4, 2008
        • 0 Attachment
          >
          > ...And neither alert gets called. Could *you*
          > try the same thing and let me know if either
          > alert is called?
          >


          Sorry, I completely overlooked that You are not doing an async-request
          but util.Get.script which I never worked with. I just tried, but all I
          get is errors in my browser's footer. I'd have to read into this first,
          but I saw there is a sample that also employs the log. Maybe You could
          implement some of that and see what is actually happening or not.
        • dietrich.frank
          ... let ... .... but I just tried this: var GetUtil = function(){ var cb = { onSuccess: function() { alert( success ); }, onFailure: function() {
          Message 4 of 15 , Mar 4, 2008
          • 0 Attachment
            >
            > And neither alert gets called. Could *you* try the same thing and
            let
            > me know if either alert is called?
            >

            .... but I just tried this:

            var GetUtil = function(){

            var cb = {
            onSuccess: function() { alert("success"); },
            onFailure: function() { alert("failure"); }
            };

            var objTransaction =
            YAHOO.util.Get.script("http://localhost/nope.js", cb);
            }

            .....
            <body>
            ...
            <input type="submit" id="cmdGetUtils" value="Get.Script"
            onClick='GetUtil()' >
            ...
            </body>


            and I get "success" everytime, although I do not have nope.js. but I
            guess that would be a matter of looking into the response.
            Calling "http://l_ocalhost..." also fires success.

            Do You have the get.js in the page header? Stupid question, otherwise
            You'd get an "Get is no object error".

            but yes, the event fires for me.

            HTH
          • shepmaster
            ... Do you happen to be running a web server locally? I am, which is why I added :5555, to make sure I don t actually end up getting a 404. For reference, the
            Message 5 of 15 , Mar 4, 2008
            • 0 Attachment
              --- In ydn-javascript@yahoogroups.com, "dietrich.frank"
              <fdietrich@...> wrote:
              >
              > YAHOO.util.Get.script("http://localhost/nope.js", cb);
              >
              > and I get "success" everytime, although I do not have nope.js. but I
              > guess that would be a matter of looking into the response.
              > Calling "http://l_ocalhost..." also fires success.

              Do you happen to be running a web server locally? I am, which is why I
              added :5555, to make sure I don't actually end up getting a 404. For
              reference, the page Firefox shows me says "Firefox can't establish a
              connection to the server at 127.0.0.1:5555" when I try to go to this
              JS URL.

              It seems like the l_ocalhost wouldn't resolve to anything, which
              should be about the same...

              What browser / OS are you doing your testing on? I would surely hope
              that that wouldn't change anything, but you never know.

              >
              > Do You have the get.js in the page header? Stupid question, otherwise
              > You'd get an "Get is no object error".

              Yep, as once I start the server, I will get the success alert. Seems
              like a pretty good indication that it is included correctly.

              > but yes, the event fires for me.
              >
              > HTH
              >
            • shepmaster
              ... wrote: I just tried to strip the problem down. Now I have 2 buttons on a page (following your example). One button loads a HTML page that exists, the other
              Message 6 of 15 , Mar 4, 2008
              • 0 Attachment
                --- In ydn-javascript@yahoogroups.com, "shepmaster" <shepmaster@...>
                wrote:

                I just tried to strip the problem down. Now I have 2 buttons on a page
                (following your example). One button loads a HTML page that exists,
                the other loads one that doesn't (for reference, the file it loads is
                the HTML page the buttons are on).

                Watching in Live HTTP Headers, I see the first one return a 304 Not
                Modified, and then I get the success alert.

                The second button returns a 404, but I do not see the failure alert. I
                would certainly expect this case to fire the failure event!
              • dietrich.frank
                ... I am calling the page from a webserver within the local network (http://192...) and call the Http://localhost against the local webserver, yes. But I don t
                Message 7 of 15 , Mar 4, 2008
                • 0 Attachment
                  > Do you happen to be running a web server locally? I am, which is why I
                  > added :5555, to make sure I don't actually end up getting a 404. For
                  > reference, the page Firefox shows me says "Firefox can't establish a
                  > connection to the server at 127.0.0.1:5555" when I try to go to this
                  > JS URL.
                  >
                  > It seems like the l_ocalhost wouldn't resolve to anything, which
                  > should be about the same...
                  >
                  > What browser / OS are you doing your testing on? I would surely hope
                  > that that wouldn't change anything, but you never know.
                  >
                  > >

                  I am calling the page from a webserver within the local network
                  (http://192...) and call the Http://localhost against the local
                  webserver, yes. But I don't have nope.js and get clear 404 on each oft
                  the calls I tried when typing them in via browser.

                  I am using XP Prof SP2 and IE 6 / 7


                  I just retried with http://192.16.11.12:5555/nope.js which is complete
                  rubbish, neither IP, port or document do exist. the request runs for
                  about 15-20 seconds, then gives me "success"
                • shepmaster
                  ... wrote: From get-debug.js: /* * The request failed, execute fail handler with whatever * was accomplished. There isn t a failure case at the * moment
                  Message 8 of 15 , Mar 4, 2008
                  • 0 Attachment
                    --- In ydn-javascript@yahoogroups.com, "shepmaster" <shepmaster@...>
                    wrote:

                    From get-debug.js:

                    /*
                    * The request failed, execute fail handler with whatever
                    * was accomplished. There isn't a failure case at the
                    * moment unless you count aborted transactions
                    */

                    Sigh.

                    I've filed a bug to add support for actually ever using this function,
                    as well as a request to add timeout functionality.
                  • dietrich.frank
                    ... reading the API, I was just about to assume the onFailure would probably fail if the script could not be parses. Anyway, You should get the onSuccess fired
                    Message 9 of 15 , Mar 4, 2008
                    • 0 Attachment
                      > From get-debug.js:
                      >
                      > /*
                      > * The request failed, execute fail handler with whatever
                      > * was accomplished. There isn't a failure case at the
                      > * moment unless you count aborted transactions
                      > */
                      >
                      > Sigh.
                      >

                      reading the API, I was just about to assume the onFailure would
                      probably fail if the script could not be parses.

                      Anyway, You should get the onSuccess fired as I did, even when the
                      server is not available. from there on You could go on by checking the
                      response.
                    • shepmaster
                      ... Yep, I get similar results when testing under IE7. However, I still never get a failure case. In every case, I get success : 1/ document exists 2/
                      Message 10 of 15 , Mar 4, 2008
                      • 0 Attachment
                        --- In ydn-javascript@yahoogroups.com, "dietrich.frank"
                        <fdietrich@...> wrote:
                        >
                        > I am calling the page from a webserver within the local network
                        > (http://192...) and call the Http://localhost against the local
                        > webserver, yes. But I don't have nope.js and get clear 404 on each oft
                        > the calls I tried when typing them in via browser.
                        >
                        > I am using XP Prof SP2 and IE 6 / 7
                        >
                        >
                        > I just retried with http://192.16.11.12:5555/nope.js which is complete
                        > rubbish, neither IP, port or document do exist. the request runs for
                        > about 15-20 seconds, then gives me "success"
                        >

                        Yep, I get similar results when testing under IE7. However, I still
                        never get a failure case. In every case, I get 'success':

                        1/ document exists
                        2/ document doesn't exist (404)
                        3/ host doesn't exist
                      • shepmaster
                        ... It seems the onSuccess only gets fired under IE (7?). On Firefox under Linux, onSuccess is only actually fired when the script is loaded. As a workaround ,
                        Message 11 of 15 , Mar 4, 2008
                        • 0 Attachment
                          --- In ydn-javascript@yahoogroups.com, "dietrich.frank"
                          <fdietrich@...> wrote:

                          > Anyway, You should get the onSuccess fired as I did, even when the
                          > server is not available. from there on You could go on by checking the
                          > response.

                          It seems the onSuccess only gets fired under IE (7?). On Firefox under
                          Linux, onSuccess is only actually fired when the script is loaded.

                          As a workaround , I will need to use some kind of timeout and call
                          abort myself, which *does* call the failure case...

                          Thanks for your help!

                          For reference, I have opened:
                          http://sourceforge.net/tracker/index.php?func=detail&aid=1907115&group_id=165715&atid=836476
                          http://sourceforge.net/tracker/index.php?func=detail&aid=1907120&group_id=165715&atid=836479

                          To address the failure case and the timeout, respectively.
                        • dietrich.frank
                          ... 6 and 7 ... Sorry, I could not do more. good luck
                          Message 12 of 15 , Mar 4, 2008
                          • 0 Attachment
                            > It seems the onSuccess only gets fired under IE (7?)...

                            6 and 7


                            > Thanks for your help!

                            Sorry, I could not do more.

                            good luck
                          Your message has been successfully submitted and would be delivered to recipients shortly.