How to solve django.template.exceptions.TemplateSyntaxError:Could not parse the remainder

Viewed 10

When I add this JS script,an error will be reported

<script src="{% static 'polls/js/script.js' %}"></script>
<script src="{% static 'polls/js/click_event.js %}"></script>
TemplateSyntaxError at /graduate/
Could not parse the remainder: ''polls/js/click_event.js' from ''polls/js/click_event.js'

but when i delete click_event.js,the page can be accessed.

click_event.js

window.onload=function(){

    var b=document.getElementsByName("hello")[0]
    b.onclick=function(){
        var url = "http://127.0.0.1:8000/graduate/hello/";
        var xhr = new XMLHttpRequest();
        xhr.open("POST",url,true);
        xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4){
                if(xhr.status==200){
                    document.getElementsByClassName(".wrapper")[0].innerHTML=xhr.responseText;
                }
            }
        };
        xhr.send();
    }
}

script.js

(function(){
       ... ...
 })(jQuery);

What should I do?

0 Answers
Related