javascript - String() Function error - Uncaught SyntaxError: missing ) after argument list -
i have function in js
<script> var currentlocation = window.location.href; function addcardtotrello() { trello.addcard({ url: currentlocation, name: string({{ soproduct.product }}), due: {{ soproduct.required_date|date:"short_date_format" }} }); } </script>
that gives me error
uncaught syntaxerror: missing ) after argument list
this how looks when parsed
<script> var currentlocation = window.location.href; function addcardtotrello() { trello.addcard({ url: currentlocation, name: string(1 4343rfcdc 54446), due: 07/30/2016 }); } </script>
the error in line
name: string(1 4343rfcdc 54446),
when value id (numeric) works ok , not getting error.
what problem?
this error happens because javascript engine doesn't know '1 4343rfcdc 54446' string, need wrap quotes. , if so, wont need string constructor because string.
trello.addcard({ url: currentlocation, name: "{{ soproduct.product }}", due: "{{ soproduct.required_date|date:"short_date_format" }}" });
Comments
Post a Comment