I'm trying to use Jquery.load() to call my jotForm Script and put the content into a div. It will not work?

  • Profile Image
    guest_23458054475054
    Asked on December 11, 2012 at 09:58 PM

    Sample Code:

    <script type="text/javascript">
          $(document).ready(function(){
            $('li.MyLink a').click(function(){
              $('#mainContent').load('HtmlPage.html', function(){
              $.getScript('http://form.www.jotform.us/jsform/SomeNumber');
              });
             });
           });

    </script>

     

    Html page has some content and <script src="jotformlocation">

  • Profile Image
    idarktech
    Answered on December 11, 2012 at 11:12 PM

    Hi,

    Can you please provide a test page where we can view the full source code? We can help you better this way. Thanks!

  • Profile Image
    guest_23458054475054
    Answered on December 12, 2012 at 01:21 AM

    Here is another test.  You can copy paste this.  The only difference on the other version is that I wanted to pull an html document with the script into a div.  This example just trys to get the script and put into the content area.

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="adipoli/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function init() {
    $.getScript("http://form.jotform.us/jsform/23457364534154", function(data) {
       $('#divResult').html(data);
    })
    }
    </script>
    </head>
    <body onload="init()">
    <div id="Wrapper" >
      <div id="divResult">
      </div>
    </div><!--End of Wrapper-->
    </body>
    </html>

  • Profile Image
    guest_23458054475054
    Answered on December 12, 2012 at 01:26 AM

    Sorry link to jquery isn't right.  Use this instead.

     

    <script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

  • Profile Image
    NeilVicente
    Answered on December 12, 2012 at 02:03 AM

    @guest_23458054475054

    JotForm uses Prototype whereas you are using jQuery for your site. For better compatibility, we recommend using the iFrame version as it is less prone to script errors, conflicts and the likes.

    To get the form's iFrame codes: iFrame embed option

    Alternatively, you may just load the form directly from its standalone URL, e.g. http://form.jotform.us/form/23457364534154

    Hope you find this post useful. Cheers!

  • Profile Image
    guest_23458054475054
    Answered on December 12, 2012 at 05:54 PM

    Thanks for the response.  I"ve ended up just putting the script in a hidden div, and when the link is clicked it will display the div.  I'm not positive, but I think that I've had issues in the past with iframes and compatibility on mobile devices.