Luke
Luke

Reputation: 2486

Jquery/Javascript Uncaught SyntaxError: Unexpected End of Input

I am getting this error from a jquery script on a specific page which performs an ajax call... and as far as I know it is generally an error caused by a missing } or )... but I have looked through the code over and over again and cannot see anything that is missing. Are there any other possible reasons this error could be flagged?

 $('#socialMedia img').click(function() {
            var id = $(this).prop('id').toLowerCase();
            $.ajax({
                    url: "./socialMedia/" + id + ".php",
                    success: function(msg) {
                            $('.socialLink').css('opacity', '0.4');
                            $(this).css('opacity', '0.9');
                            if ($('#Feed').css('display') != 'none') {
                                    $('#Feed').slideToggle(400, function() {
                                            $('#Feed').html(msg);
                                    });
                            }
                            else
                            {
                                    $('#Feed').html(msg);
                            }
                            $('#Feed').slideToggle(400);
//                              if ($('#'+id+'Script').length <= 0) {
//                                      $('head').append('<script type="text/javascript" src="./script/' + id + '.js" id="'+id+'Script"></script>');
//                              }
                            //alert(msg);
                    }
            });
    });

EDIT: you can "see" (you won't actually see anything as the error causes the page never to be loaded) the page by going to http://www.luketimoth.me... and then clicking "contact.me" (it is an AJAX site, and I have not yet implemented any handling of url specifiers)

Upvotes: 0

Views: 1524

Answers (1)

AdamKG
AdamKG

Reputation: 14081

The problem is in the AJAX response at this URL:

http://www.luketimoth.me/pages/contact.me.php

The ending </script> tag actually causes the end of that script portion - double-slash comment syntax is for javascript, the HTML parser doesn't respect it and ends the script section right there.

Upvotes: 1

Related Questions