I don't know why the error is happening: Uncaught SyntaxError: Unexpected token ':'

Asked 1 years ago, Updated 1 years ago, 48 views

Uncaught SyntaxError: Unexpected token ':'

There is...
I don't know why it's an error.
I think I made a mistake on JS.

<script>
    function createLink(){
        const div3 = document.getElementById("div3");
        if(!div3.hasChildNodes()){
            consta1 = document.createElement("a");
            a1.href='+{route('alink')}}+';
            a1.innerText="itsakura";
            div3.appendChild(a1);
        }
    }

javascript laravel

2022-09-30 19:55

1 Answers

I don't know anything about Ravel, but

a1.href='+{route('alink')}}+';

{{route('alink')} may be expanded to the URL to look like ='+http://example.com/+'.Check the source using browser features instead of the source file you are editing.


2022-09-30 19:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.