-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext1.php
More file actions
67 lines (65 loc) · 1.91 KB
/
Copy pathtext1.php
File metadata and controls
67 lines (65 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html ng-app="ajaxApply">
<head>
<meta charset="utf-8">
<title>ajax请求</title>
</head>
<body>
<div ng-controller="ctrl">
<table width="100%">
<!-- <tr ng-repeat="item in farmDatas">
<td width="33%">{{LTM526 + item.process_id}}</td>
<td width="33%">{{item.seed_type}}</td>
<td width="33%">{{item.creating_time}}</td>
</tr>
</table> -->
<p>
{{farmDatas}}
</p>
</div>
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- angularjs框架 -->
<script src="https://cdn.bootcss.com/angular.js/1.6.3/angular.min.js"></script>
<!-- bootstrap框架 -->
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
var app = angular.module('ajaxApply', []);
app.controller('ctrl', ['$scope','$q', function($scope,$q){
var defferd = $q.defer();
$.ajax({
url: 'src/php/test.php',
type: 'GET',
dataType: '',
data: {},
success: function(result,status,xhr) {
// defferd.resolve(xhr.getResponseHeader("Server"));
// defferd.resolve(xhr);
// var response = {
// data: result,
// status: status,
// xhr: xhr
// }
// defferd.resolve(response);
console.log("result: " + result)
defferd.resolve.apply(defferd,arguments);
},
error: function(xhr,status,error) {
defferd.reject(error);
}
});
defferd.promise
.then(
function(response){
// $scope.farmDatas = response.xhr.getResponseHeader("Server");
// $scope.farmDatas = response.getResponseHeader("Server");
$scope.farmDatas = JSON.parse(response).sites;
// $scope.farmDatas = response.sites;
console.log(response);
},function(response){
$scope.farmDatas = response;
}
);
}]);
</script>
</body>
</html>