5

I am trying to use sails.js and Zurb Foundation 6.2. I used this handy npm generator that sets up my grunt tasks. The output looks pretty good. I have a single js file that contains jquery, foundation, etc.

In my layout.ejs, I have this:

<!DOCTYPE html>
<html>
  <head>
    <title><%=typeof title == 'undefined' ? 'New Sails App' : title%></title>

    <!-- Viewport mobile tag for sensible mobile support -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!--STYLES-->
    <link rel="stylesheet" href="/styles/app.css">
    <!--STYLES END-->

  </head>


  <body>
...  some html ...
    <%- body %>

    <!--SCRIPTS-->
    <script src="/js/dependencies/sails.io.js"></script>
    <script src="/js/dependencies/foundation.js"></script>
    <!--SCRIPTS END-->
     <script>
            $(document).foundation();
        </script>
  </body>

</html>

When I run the page, I get this error:

**TypeError: url.indexOf is not a function
jQuery.fn.load()
 foundation.js:9612
<anonymous>
 foundation.js:11913
<anonymous>**

My reading on this suggests that the issue is either that something is not be loaded, is being loaded more than once, or is in the wrong order. How do I narrow that down? I tried to use CDN's for each piece and still couldn't make it work.

Thank you for your help.

Matt Knight
  • 499
  • 2
  • 7
  • 20
  • What version of jQuery are you using? I got the same error when using 3.0.0, so I rolled back to 2.2.4 – d_rail Jun 21 '16 at 01:12

1 Answers1

5

Foundation is not currently compatible with jQuery 3.0.0, Foundation is using the deprecated jQuery.fn.load(). Use jQuery 2.2.x for now. See issue and PR:

https://github.com/zurb/foundation-sites/issues/8834

https://github.com/zurb/foundation-sites/pull/8923

d_rail
  • 4,109
  • 32
  • 37
  • 1
    I found the issue a day after I posted this and forgot to update my initial post. You are correct, it is the version of JQuery. – Matt Knight Jun 21 '16 at 01:59