How to solve Uncaught SyntaxError: Unexpected token : ?
rajasimon opened this issue · comments
<byutv-jsonp
auto
url="https://ajax.googleapis.com/ajax/services/search/news?v=1.0&rsz=8&pz=1&cf=all&ned=in&hl=en&topic=tc"
debounce-duration="300"
callbackKey = "callback"
last-response="{{lastResponse}}"
last-error="{{lastError}}"></byutv-jsonp>
This looks like very simple right? but it throws below error
Uncaught SyntaxError: Unexpected token :
How to solve this ?
I am having the exact same problem
Currently the query parameters that are added to the end of the url
attribute need to be removed from the url
attribute and added to the params
attribute as a double quoted JSON string.
For example:
<byutv-jsonp
auto
url="https://ajax.googleapis.com/ajax/services/search/news"
params='{"v":"1.0","rsz":"8","pz":"1","cf":"all","ned":"in","hl":"en","topic":"tc"}'
last-response="{{lastResponse}}"
last-error="{{lastError}}"
debounce-duration="300"></byutv-jsonp>
I have tested this and it should resolve your problem. Does this change work for you?
Also, the default callback-key
is callback
; there is no need to add this attribute in your case. If you do need to customize the callback key the attribute should be written as callback-key
not callbackKey
This issue was resolved here and on this stackoverflow question. There could possibly be an enhancement made to output a more helpful error message or allow query parameters in the URL attribute. If these enhancements are desired please open a new issue.
@coderfin what if i want to send some variable in my params? In this case the params are static but i need the case where the params are dynamic.
@gauravkk22 Can you try something like this: https://stackoverflow.com/a/34165439/2344083