`
zqb666kkk
  • 浏览: 726875 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

ajax跨域调用和非跨域调用的写法

    博客分类:
  • ajax
阅读更多
//支持跨域调用
	$.ajax({  
		type:"POST",  
		async :false,  
		url:"http://web3.com:9080/authority/dept/hellob.shtml?userName=zqb&callback=?",  
		dataType:"jsonp",  
		success:function(data){  
			//alert(data);
			console.log(data);
		},  
		error:function(){  
		alert("error");  
		}  
		  
		});  

	  
	  }
	  //不支持跨域调用
	  function b(){
		  
		  $.ajax({
		        type: "post",
		        dataType: "html",
		        url: "http://web3.com:9080/authority/dept/hellob.shtml?userName=zqb",
		        data: "",
		        success: function (data) {
		        	console.log(data);
		        }
		    });
		  
	  }
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics