首页 > Web开发 > 详细

ajax 跨域问题

时间:2015-05-22 19:01:09      阅读:288      评论:0      收藏:0      [点我收藏+]

1.jquery ajax自己常用写法如下:

技术分享
$.post(url,data,function(data){
    //data为返回的数据
});
$.post写法
技术分享
1 $.get(url,data,function(data){
2     //与post相同,只是传输方式不同
3 });
$.get写法
技术分享
 1 $.ajax({
 2     type: ‘get‘,//or post
 3     url: ‘http://xxxx‘,
 4     data:‘‘,//这里可以写$(‘form‘).serialize();序列化表单  or  json 串
 5     dataType:‘json‘,
 6     success: function(data){
 7         //success之后操作
 8     },
 9     error:function(){
10         //error操作
11     }
12 });
$.ajax写法

2.ajax跨域问题

(1).用get方式

(2).传json串

ajax 跨域问题

原文:http://www.cnblogs.com/leilin007/p/4522961.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!