AngularJS $http跨域
来源:互联网 发布:无法连接到数据库 编辑:程序博客网 时间:2024/05/16 10:06
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>AngularJS $http跨域</title></head><body ng-app="App"><div ng-controller="DemoController"></div><script>function fn(arg) {console.log(arg);document.write('111');}</script><!-- <script src="./jsonp.php?callback=fn"></script> --><script src="./libs/angular.min.js"></script><script src="./libs/jquery.min.js"></script><script>// 1、JSONP 跟Ajax 没有关系// 2、$.ajax({// });// 3、$.ajax({// url: 'example.php',// type: 'post',// dataType: 'jsonp'// })// var script = createElement('script');// script.src = url;// var head = document.querySelector('head');// head.appendChild(script);// // $.ajax({// url: 'jsonp.php',// dataType: 'jsonp'// });var App = angular.module('App', []);App.controller('DemoController', ['$http', '$scope', function ($http, $scope) {$http({url: 'jsonp.php?a=JSON_CALLBACK',method: 'jsonp' // 采用JSONP方式}).success(function (info) {console.log(info);});}]);</script></body></html>
0 0
- AngularJS $http跨域
- AngularJS $http跨域
- angularjs $http
- AngularJS $http
- angularjs $http
- AngularJS http
- AngularJS $http
- AngularJs(四):$Http,$resource
- AngularJS $http Service
- AngularJS $http使用
- AngularJS中$http
- 10009---AngularJS Http
- AngularJS(03)---Http对象
- AngularJS $http service
- AngularJS $http简介1
- AngularJS - $http的config
- AngularJS for $http
- AngularJS中http拦截
- 队花的烦恼 (DP)
- java 删除集合的办法
- uC/OS-ii内核理解(六)初始化TCB-OS_TCBInit函数
- springboot搭建web(静态资源访问)(三)
- web应用安全之HTTP与会话管理总结
- AngularJS $http跨域
- Java2SE基础知识点整理(二)
- CentOS Linux系统下更改Apache默认网站目录
- SSO的本质以及实现方法
- gradle run命令下无法读取终端输入
- 插入排序(Insertion Sort)
- 白夜行——爱情与犯罪
- TensorFlow系列03——TensorFlow基本概念Tensor理解
- 《深入理解java虚拟机》笔记——第六章 类文件结构