6 Replies Latest reply on Sep 1, 2014 9:57 AM by mikebeargie

    Trying to test a small jquery code in webviewer

    shae1725

      Hoping some one can help me out

       

      I am trying to test jquery in my webviewer using urls for the script source before I try to embed them in my fm database and start experimenting

       

      Problem is I cant get this small test code to work! It is taken from the jquery examples page and I was confident it would just work

       

      Any ideas on what I am doing wrong?

       

       

       

      help1.PNGhelp2.PNG

        • 1. Re: Trying to test a small jquery code in webviewer
          mikebeargie

          improper use of the List() function?

           

          You have an ampersand after the first line instead of a semicolon.

           

          Make sure to use the data viewer to check your calculations first to make sure the code you want to render is rendering as expected.

          • 2. Re: Trying to test a small jquery code in webviewer
            shae1725

            Thanks for reply Mike

             

            should I not be using list?

             

            I am pretty much on a steep learning curve at the moment so apologies for mybe sounding dumb

             

            The list function and ampersand I inherited from a demo I was shown, so I used thinking they were needed!

             

            I changed the ampersand to a semi colon but no change!

            • 3. Re: Trying to test a small jquery code in webviewer
              mikebeargie

              All of your script/file sources are also missing http: in front of the links. //code.jquery.com is not a valid link.

               

              The ampersand wasn't a big thing, it's just odd that they would use it since they are breaking all of the other lines.

               

              I'm not going to retype everything from your screenshot out to find problems. You are welcome to post sandbox .fmp12 files on technet to try and get assistance troubleshooting an actual file.

               

              Also know that if you load from a web source via http://, you will be required to be connected to the internet for your webviewer to work. There are methods to store those referenced files and call them locally to the user to negate the need for an internet connection.

              • 4. Re: Trying to test a small jquery code in webviewer
                shae1725

                Hi Mike

                 

                I added the http and the demo is now working

                 

                I know its the wrong technique but I only seem to learn anything by diving straight in.

                 

                Now thats working I have added the jquery library to a global text field and going to try to get the code to fetch it.

                 

                Is a text field the correct place?

                • 5. Re: Trying to test a small jquery code in webviewer
                  shae1725

                  Just seen a demo from seedcode calling javascript librarys!!!

                   

                  I nearly choked! thats way over and above my skill set!

                   

                  Is there any other easier way?

                  • 6. Re: Trying to test a small jquery code in webviewer
                    mikebeargie

                    Actually, the seedcode example was something I was going to suggest before but figured it might be hard for you to understand. They are really good resources though, and it's the most thorough example of how to localize your loading of libraries.

                     

                    The issue with storing things in text fields is that text fields run into character limits, so your code might get cut off before it's even assembled, which can lead to very frustrating troubleshooting time.