camsong / fetch-jsonp

Make JSONP request like window.fetch
998 stars 156 forks source link

Uncaught SyntaxError: Unexpected token : error #43

Closed jerofree closed 7 years ago

jerofree commented 7 years ago

I met problem "Uncaught SyntaxError: Unexpected token : error", how could solve this?

camsong commented 7 years ago

what's your request and the response

jerofree commented 7 years ago

request : http://120.76.205.241:8000/post/leifeng?kw=机器人&apikey=9h3u1TkxiQnH7rMeKQOPcCseDid5HzUZ8WaV0HFkOc6Ie8Su6aK6fkM6wDTQZ2dL

response: {"hasNext": true, "retcode": "000000", "appCode": "leifeng", "dataType": "post", "pageToken": "2", "data": [{"posterId": "23936", "parentPosterScreenName": null, "tags": ["\u67d4\u6027\u53ef\u4f38\u5c55\u7535\u5b50", "\u673a\u5668\u4eba", "\u4eba\u9020\u76ae\u80a4", "\u4f11\u65af\u987f\u5927\u5b66"], "publishDate": 1505722269, "likeCount": 0, "commentCount": null, "publishDateStr": "2017-09-18T08:11:09", "id": "169217", "viewCount": 388, "posterScreenName": "\u6b23\u5f64Iris", "title": "\u8d4b\u4e88\u673a\u5668\u624b\u4e00\u5c42\u53ef\u611f\u53d7\u6e29\u5ea6\u7684\u76ae\u80a ...........so many .........................}]}

It seems that response is not json text; error: Uncaught SyntaxError: Unexpected token : proxyConsole.js:56 Error: JSONP request to http://120.76.205.241:8000/post/leifeng?kw=机器人&apikey=9h3u1TkxiQnH7rMeKQOPcCseDid5HzUZ8WaV0HFkOc6Ie8Su6aK6fkM6wDTQZ2dL timed out at fetch-jsonp.js:85

I did not how to deal with it ,but i want to get the json text that the API interface define.

camsong commented 7 years ago

It's a JSON request not a JSONP request, please refer to the backend dev for help