5 Replies Latest reply on Apr 7, 2013 7:53 AM by heathrowe

    still trying to load text :-(

    mobly Level 3

      Gosh, this is taking me a long time! Can anyone help?

      I've got my div container called "container" and trying to load it with the text at the url below.

      This code is enetered in  creationComplete, I saw this example below working with  iFame code copied from a google map, that worked, so I thought I could replace the iFrame with the url where the copy is, but all that this code does is put the URL address in the container.

      So clearly I'm missing a step!

      can any one help please?


      var container = sym.$("container");

      var Copy = "http://brandzapp.appspot.com/text?docKey=cat_beer&format=html2";






        • 1. Re: still trying to load text :-(
          mobly Level 3

          thanks to resdesign..... this does what i wanted;




                      url : "foo.txt",

                      success : function (data) {




          • 2. Re: still trying to load text :-(
            heathrowe Most Valuable Participant

            Have a look at the jquery 'load' method: http://api.jquery.com/load/


            So in your case something like this will work as well.





            • 3. Re: still trying to load text :-(
              mobly Level 3

              Hi Darrell

              Thanks fella! that works too, more than one way to skin a cat then :-)

              Just for the community, these 2 lines also work;


              var container = sym.$("container");



              I'm not great at the coding side of things, but am trying to pick it up, (you can teach old dogs new tricks, just slowly!!)

              So how come they don't make the "View in browser" live, it nearly caught me out when I started doing this.


              Thanks very much for your help.

              P.S I think I'll go and get jQuery for Dummies, that's about my level at the moment!

              • 4. Re: still trying to load text :-(
                mobly Level 3

                Just to prove that I'm trying to learn this stuff, I read the page at http://api.jquery.com/load/

                So I was thinking why should I have to write "container" 3 times? ... and you don't, this line below works too.


                var container=sym.$("container").load('http://brandzapp.appspot.com/text?docKey=cat_beer&format=html2');


                I will continue to thank Darrell and the likes, and hope one day I can give back just as much




                Another P.S I'm still doing this a bit trial and error, so if any one fancies trying to explain to me the difference between this .load method and the earlier $.ajax version, that would be lovely :-)

                • 5. Re: still trying to load text :-(
                  heathrowe Most Valuable Participant

                  Ajax =  Asynchronous JavaScript and XML merely solved the client-side access to external data without resorting to server-side languages (.php, .asp, .NET etc).

                  This method exploded when Web 2.0 came on the scene when javascript developers used this to create web applications. I may be inaccurate in stating this, but I believe, Ajax pre-dates the popularity of the jQuery library that javascript developers rely heavly on these days. But within the jQuery framework exists the original ajax method (the one Marie references), and their are simplfied spin-off or 'shorthand 'ajax' functions/methods that 'get external data':




                  Example case is the get link reference - within that page the specs mention, its short-hand notation is nothing more than a another way of writing the original ajax method, with some additional parameters to pass to the fuction (if required).


                  All are good use cases; some are specific; so you will have to decide which is best for the project at hand.