jsonp 请求报Uncaught SyntaxError: Unexpected token :
$(document).ready(function() { jQuery.ajax({
type: 'GET',
url: 'http://wncrunners.com/admin/colors.json' ,
dataType: 'jsonp',
success: function(data) {
alert('success');
}
}); });//end document.ready
最简单的Jsnop请求 确报Uncaught SyntaxError: Unexpected token : 最后问了一下google,才明白
You've told jQuery to expect a JSONP response, which is why jQuery has added the callback=jQuery16406345664265099913_1319854793396&_=1319854793399
part to the URL (you can see this in your dump of the request).
What you're returning is JSON, not JSONP. Your response looks like
{"red" : "#f00"}
and jQuery is expecting something like this:
jQuery16406345664265099913_1319854793396({"red" : "#f00"})
If you actually need to use JSONP to get around the same origin policy, then the server serving colors.json
needs to be able to actually return a JSONP response.
If the same origin policy isn't an issue for your application, then you just need to fix the dataType
in your jQuery.ajax
call to be json
instead of jsonp
.
jsonp 请求报Uncaught SyntaxError: Unexpected token :的更多相关文章
- js报Uncaught SyntaxError: Unexpected token <错误 解决方法
js报Uncaught SyntaxError: Unexpected token <错误 解决方法 错因 js被shiro的拦截器拦下,访问不了 #shiro的配置 shiro: hash-a ...
- jsonp 跨域Uncaught SyntaxError: Unexpected token :解决方法
[jQuery]Ajax实现跨域访问JSON Ajax跨域访问JSON 环境:.net4.0+jQuery+JSON.net 因为在跨域实现,所以这里新建网站,这个网站只需要Ashx文件 public ...
- shiro拦截所有报 Uncaught SyntaxError: Unexpected token '<' 解决方法
改成 -> filterChainDefinitionMap.put("/css/**", "anon");filterChainDefinitionMa ...
- Uncaught SyntaxError: Unexpected token <解决方法
最近剥离基础框架的公共部分,早上有个页面部分流程未加载出来,报了Uncaught SyntaxError: Unexpected token <,网上搜了下 错误原因:js脚本中非正常引用外部的 ...
- "Uncaught SyntaxError: Unexpected token <"错误完美解决
今天写代码的时候发现了"Uncaught SyntaxError: Unexpected token <" <html>的js错误,而且还是html的第一行,我就 ...
- 前端javascript 错误 Uncaught SyntaxError: Unexpected token ILLEGAL
前端控制台报Uncaught SyntaxError: Unexpected token ILLEGAL 错误时,就是非法字符错误,首先检查符号是否正确,不要出现中文标点! 然后检查参数之类的类型是否 ...
- Uncaught SyntaxError: Unexpected token o
浏览器报Uncaught SyntaxError: Unexpected token o 这原因是你ajax获取数据的时候对数据进行错误操作,比如使用了 JSON.parse(data) 对数据进行转 ...
- 【Vue中的坑】Vue打包上传线上报Uncaught SyntaxError: Unexpected token <
今天在vue打包上传线上后,报一下错误,一下就懵了,这可咋整啊,一如既往的想都没想就开始复制错误,上网开搜 Uncaught SyntaxError: Unexpected token < Un ...
- 关于Uncaught SyntaxError: Unexpected token o in JSON at position 1,chrome持续报错的相关解析
今天跟大家分享我前两天遇见的一个BUG,说出来很难受,因为这个BUG花了我一个多小时去找原因,后来莫名其妙的故障消失了,强迫症犯了的我,居然花了2个多小时去故意再制造这个BUG,只想弄明白WHY??? ...
随机推荐
- USACO training course Checker Challenge N皇后 /// oj10125
...就是N皇后 输出前三种可能排序 输出所有可能排序的方法数 vis[0][i]为i点是否已用 vis[1][m+i]为i点副对角线是否已用 m+i 为从左至右第 m+i 条副对角线 vis[1] ...
- java关于lombok(包括父类参数)
java关于lombok对bean对象进行自动设置 使用说明 使用方式 注释类型 @NonNull @Data(常用) @NoArgsConstructor(常用)/@RequiredArgsCons ...
- 使用CEfSharp之旅(2) js前台事件执行后台方法
原文:使用CEfSharp之旅(2) js前台事件执行后台方法 版权声明:本文为博主原创文章,未经博主允许不得转载.可点击关注博主 ,不明白的进群191065815 我的群里问 https://blo ...
- C#查找List 某一段数据
public void SelectData() { List<int> r = new List<int>(); r.Add(); r.Add(); r.Add(); r.A ...
- LeetCode 38.报数(Python3)
题目: 报数序列是一个整数序列,按照其中的整数的顺序进行报数,得到下一个数.其前五项如下: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 被读作 "one 1& ...
- sql.xml 循环插入与修改写法
// 插入 (交互一次数据库) <insert id="insertClient"> insert into m_linknodeclient (LinkClientI ...
- js遍历获取表格内数据方法
1.一般的表格结构如下 <table> <tr> <td>id</td> <td>name</td> </tr> & ...
- kafka集群搭建文档
kafka集群搭建文档 一. 下载解压 从官网下载Kafka,下载地址http://kafka.apache.org/downloads.html 注意这里最好下载scala2.10版本的kafka, ...
- 101 删除排序数组中的重复数字 II
原题网址:http://www.lintcode.com/zh-cn/problem/remove-duplicates-from-sorted-array-ii/# 跟进“删除重复数字”: 如果可以 ...
- Android基础控件DatePicker的使用
1.简介 DatePicker日期选择器,自带spinner和calendar两种模式,相关属性: android:calendarTextColor : 日历列表的文本的颜色 android:cal ...