网关跨域测试

<html>
12321
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
 $(document).ready(function(){ 
    $.ajax({
		// 请求地址
		url:'http://framework-register/auth/oauth/token?grant_type=password&username=zhaoguang&password=123456',
		// 请求参数
		//data:{grant_type:"password",username:"zhaoguang",password:"123456"},
		//headers:{Authorization: 'Basic dGVzdDp0ZXN0', entIdent: 'test.ailieyun.com'},
		beforeSend: function(XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("Authorization", "Basic dGVzdDp0ZXN0");
			XMLHttpRequest.setRequestHeader("entIdent", "192.168.2.30");
        },
		// 请求类型
		type:'POST',
		// 成功的回调
		success:function(data){
			console.log(data) 
		}
    })
}); 
</script>
</html>

你可能感兴趣的:(前端,javascript,前端,ajax)