-3

OK, here's my issue I use following page to get the user timezone

<html>
    <head>
        <script src="/js/jquery-2.1.4.js"></script>
        <script src="/js/jstz-1.0.4.min.js"></script>
    </head>
    <body>
        <form id="tz-form" action="{{ URL::to('/') }}" method="post">
            <input id="tz" type="hidden" name="timezone" value="">
        </form>
        <script>
            $(document).ready(function(){
                var timezone = jstz.determine();
                $('#tz').val(timezone.name());
                $('#tz-form').submit();
            });
        </script>
    </body>
</html>

when I run the application firebug shows me following errors

  1. SyntaxError: expected expression, got '<' html tag
  2. ReferenceError: PhpDebugBar is not defined var phpdebugbar = new PhpDebugBar.DebugBar(); TypeError: $ is not a function
  3. $('#tz').val(timezone.name());

I'm using laravel 5.1 and barryvdh/laravel-debugbar. Thank you

Ravisha Hesh
  • 1,504
  • 13
  • 19

1 Answers1

0

Ok, I found the solution, this happens from the

jQuery.noConflict(true);

as Arrakeen said, that adds automatically to the page

so I added change my script to this and it worked. :)

    <script>
        var jq = jQuery.noConflict();
        jq(document).ready(function(){
            var timezone = jstz.determine();
            jq('#tz').val(timezone.name());
            jq('#tz-form').submit();
        });
    </script>
Community
  • 1
  • 1
Ravisha Hesh
  • 1,504
  • 13
  • 19