码迷,mamicode.com
首页 > Web开发 > 详细

ajax 跨域问题

时间:2015-05-22 19:03:28      阅读:170      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!