jsonpHandler({
"code": "aaa",
"price": 1780,
"tickets": 5
}); //后端发过来的josnp格式,jsonpHandler必须和ajax中的jsonpCallback的参数相同,
    //此参数可以从前端传过来的参数中获取到(一般情况参数名是:callback)

  

$.ajax({
type:"POST",
url:"yourUrl",
data:{},
dataType:"jsonp",
timeout:6000,
jsonpCallback:"jsonpHandler",
error:function(XMLHttpRequest,textStatus,errorThrown){
if(textStatus=="timeout"){
alert('抱歉!请求超时,请重试!或请检查您的网络状况!');
return false;
}else if(textStatus=="error"||textStatus=="parsererror"){
alert('抱歉!系统发生错误,请重试!');
console.log(errorThrown);
return false;
}else if(textStatus=="abort"){
alert('抱歉!程序发生中断,请重试!');
return false;
}
},
complete:function(){ },
beforeSend:function(){ },
success:function(backData,textStatus){
console.log(backData);
}
});

  

最新文章

  1. DevExtreme 学习应用[2]
  2. 一个js获取数组下标的函数
  3. strcpy和memcpy的区别(转载)
  4. c#多态之抽象类与接口的一点收获~~
  5. 无法查找或打开pdb文件
  6. ld: library not found for -lPods-AFNetworking
  7. leecode 每日解题思路 102-Binary Tree Level Order Traversal
  8. Uva 122 树的层次遍历 Trees on the level lrj白书 p149
  9. 2017春 前端自动化(二) 页面自动刷新、sass与css转换的使用、pxToRem直观转换
  10. HanLP自然语言处理包介绍
  11. Eclipse maven 错误修正方法:An error occurred while filtering resources
  12. 为什么说Thunderbird是最好的桌面RSS阅读器
  13. github开源库(二)
  14. Android------------fragment数据传递
  15. 1217. [HNOI2003]消防局的设立【贪心】
  16. Tomcat与Spring中的事件机制详解
  17. tensorflow高级库
  18. Linux VPS主机利用Crontab实现定时重启任务
  19. 【luogu P1825 [USACO11OPEN]玉米田迷宫Corn Maze】 题解
  20. embedded tomcat运行java web,Unable to compile class for JSP

热门文章

  1. Wow! Such Doge! - HDU 4847 (水题)
  2. M - 昂贵的聘礼 - poj1062
  3. angularJS 服务三
  4. C#中操作WMI的类库-实现远程登录共享
  5. "Storage Virtualization" VS "Software-Defined Storage"
  6. Ruby On Rails 4 hello world,Ruby On Rails上手
  7. PHP安全编程:不要让不相关的人看到报错信息(转)
  8. Day7 - Python基础7 面向对象编程进阶
  9. AlertDialog dismiss 和 cancel方法的区别
  10. codevs 1993 草地排水 USACO