I send a GET request from the back end to get the json response. I got this error.
Uncaught SyntaxError: Unexpected token :
at DOMEval (jquery-3.3.1.js:111)
at Function.globalEval (jquery-3.3.1.js:345)
at text script (jquery-3.3.1.js:9640)
at ajaxConvert (jquery-3.3.1.js:8787)
at done (jquery-3.3.1.js:9255)
at XMLHttpRequest. (jquery-3.3.1.js:9548)
My AJAX request code is:
$.ajax({
type: "GET", //rest Type
dataType: 'jsonp', //mispelled
url: "{{ url_for('live') }}",
contentType: "application/json",
success: function (msg) {
console.log(msg);
for (var i = 0; i < msg.counters.length; i++) {
var counter = msg.counters[i];
console.log(counter);
}
},
error: ErrorMsg
});
I have no idea where I went wrong. please help.
