jquery ajax请求失败
请教高手看一下,这段代码为什么报错!
$(function () {
$.ajax({ type: "GET", url: "http://m.weather.com.cn/data/101180101.html?callback=?", dataType: "jsonp", jsonp: 'callback', success: function (json) { alert(json); }, error: function () { alert('fail'); } });
});
你好谨轮!!
weather.com.cn不支持jsonp,url返回的是一个做核html内容,而非纯json内纯晌掘容····因此无法解析···
{
"weatherinfo":[
"city": "郑州",
"city_en": "zhengzhou",
"date_y": "2013年11月22日",
"date": "",
"week": "星期五",
"fchh": "11",
"cityid": "101180101",
"temp1": "12℃~5℃",
"temp2": "13℃~5℃",
"temp3": "13℃~2℃",
"temp4": "13℃~0℃",
"temp5": "14℃~-1℃",
"temp6": "10℃~-2℃",
"tempF1": "53.6ㄈ~41ㄈ",
"tempF2": "55.4ㄈ~41ㄈ",
"tempF3": "55.4ㄈ~35.6ㄈ",
"tempF4": "55.4ㄈ~32ㄈ",
"tempF5": "57.2ㄈ~30.2ㄈ",
"tempF6": "50ㄈ~28.4ㄈ",
"weather1": "多云转小雨",
"weather2": "小雨",
"weather3": "多云转晴",
"weather4": "晴",
"weather5": "晴",
"weather6": "晴",
"img1": "1",
"img2": "7",
"img3": "7",
"img4": "99",
"img5": "1",
"img6": "0",
"img7": "0",
"img8": "99",
"img9": "0",
"img10": "99",
"img11": "0",
"img12": "99",
"img_single": "1",
"img_title1": "多云",
"img_title2": "小雨",
"img_title3": "小雨",
"img_title4": "小雨",
"img_title5": "多云",
"img_title6": "晴",
"img_title7": "晴",
"img_title8": "晴",
"img_title9": "晴",
"img_title10": "晴",
"img_title11": "晴",
"img_title12": "晴",
"img_title_single": "多云",
"wind1": "微风",
"wind2": "微风",
"wind3": "微风",
"wind4": "微风",
"wind5": "微风",
"wind6": "微风",
"fx1": "微风",
"fx2": "微风",
"fl1": "小于3级",
"fl2": "小于3级",
"fl3": "小于3级",
"fl4": "小于3级",
"fl5": "小于3级",
"fl6": "小于3级",
"index": "较冷",
"index_d": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。",
"index48": "较冷",
"index48_d": "建议着厚外套加毛衣等服装。樱搜年老体弱者宜着大衣、呢外套加羊毛衫。",
"index_uv": "最弱",
"index48_uv": "最弱",
"index_xc": "不宜",
"index_tr": "适宜",
"index_co": "较舒适",
"st1"闷颂春: "12",
"st2": "5",
"st3": "13",
"st4": "5",
"st5": "13",
"st6": "4",
"index_cl": "适宜",
"index_ls": "基本适宜",
"index_ag"蚂耐: "不易发"
]
}
他的错误说的是缺少‘;’,自己看看呗