我寫(xiě)了一段ajax 前提是后臺(tái)接口沒(méi)有錯(cuò)誤可以訪問(wèn) //ajax 關(guān)于下載內(nèi)容 $(".download").click(function(){ $.ajax({? ? ? ? ? ? ?type: "GET",? ? ? ? ? ? ?url: "http://test.v2.hzpnc.com/business/newest-apk-version-for-personal",? ? ? ? ? ? ?dataType: "jsonp",? ? ? ? ? ? ?success: function(response,status,xhr){? ? ? ? ? ? ? console.log("cy");? ? ? ? ? ? ? console.log(response)? ? ? ? ? ? ?},? ? ? ? ? ? ?error:function(response){? ? ? ? ? ? ? console.log(response)? ? ? ? ? ? ?} }) })可能因?yàn)閡rl是跨域的url里面的內(nèi)容是:{"id":47,"file":"Project611_4.5.3_I_Release_201601251347-pinocchio.apk","appver":"4.5.3_Release","contents":"1.取消了快捷方式的默認(rèn)安裝改為提示用戶安裝\n2.修復(fù)部分BUG,增加穩(wěn)定性","integral":10,"created_at":"2016-01-25 14:41:15","charger":"名字","state":1}但是我那樣請(qǐng)求 就報(bào)錯(cuò)了 里面的respone也打印不出來(lái)?報(bào)錯(cuò):Uncaught SyntaxError: Unexpected token :?請(qǐng)問(wèn)大神們是怎么回事
1 回答

Licco
TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超0個(gè)贊
jquery的jsonp請(qǐng)求,需要傳成功回調(diào)的函數(shù),服務(wù)器返回這個(gè)函數(shù)的執(zhí)行,你的代碼要改一下的,不能直接返回json格式的對(duì)象
- 1 回答
- 0 關(guān)注
- 1672 瀏覽
添加回答
舉報(bào)
0/150
提交
取消