跨域问题
可以采用JQuery的getJSON、get方法以JSONP的方式可实现跨域,给个例子:
1.$.ajax({
2.type:"get",
3.async:false,
4.url:"http://w1270.0.01:8080/test.php",
5.dataType:"jsonp",
6.jsonp:"callbackparam",//服务端用于接收callback调用的function名的参数
7.jsonpCallback:"success_jsonpCallback",//callback的function名称
8.success:function(json){
9.alert(json);
10.alert(json[0].name);
11.},
12.error:function(){
13.alert('fail');
14.}
15.});
相关推荐
fengchao000 2020-06-17
adonislu 2020-05-16
zmosquito 2020-05-10
adonislu 2020-05-10
somebodyoneday 2020-04-22
fengchao000 2020-04-22
fengchao000 2020-04-11
Richardxx 2020-03-07
somebodyoneday 2020-03-06
fengchao000 2020-03-05
somebodyoneday 2020-02-16
xiaouncle 2020-02-13
baijinswpu 2020-01-29
fengchao000 2020-01-10
fengchao000 2019-12-25
newthon 2019-12-23
somebodyoneday 2013-07-11