###monacaで外部ドメインへのGET、POST送信を実現したいです
調べてみたところ、ajaxを使う方法とangularJSを使う方法があるようなのですが、
どちらでも構わないのでお教えいただけると助かります。
下記はangularJSを使用してテストいているパターンです。
###発生している問題・エラーメッセージ
VM8101 angular.min.js:92 Mixed Content: The page at 'https://ide.monaca.mobi/project/57b3ba76fd17341f629a95a1' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://example.info/index.php?value1=1&value2=2'. This request has been blocked; the content must be served over HTTPS.(anonymous function) @ VM8101 angular.min.js:92n @ VM8101 angular.min.js:88f @ VM8101 angular.min.js:86(anonymous function) @ VM8101 angular.min.js:120$eval @ VM8101 angular.min.js:134$digest @ VM8101 angular.min.js:132$apply @ VM8101 angular.min.js:135(anonymous function) @ VM8101 angular.min.js:19e @ VM8101 angular.min.js:39d @ VM8101 angular.min.js:19Ac @ VM8101 angular.min.js:20(anonymous function) @ VM8114 angular-onsenui.min.js:2 VM8101 angular.min.js:92 XMLHttpRequest cannot load http://example.info/index.php?value1=1&value2=2. Failed to start loading.(anonymous function) @ VM8101 angular.min.js:92n @ VM8101 angular.min.js:88f @ VM8101 angular.min.js:86(anonymous function) @ VM8101 angular.min.js:120$eval @ VM8101 angular.min.js:134$digest @ VM8101 angular.min.js:132$apply @ VM8101 angular.min.js:135(anonymous function) @ VM8101 angular.min.js:19e @ VM8101 angular.min.js:39d @ VM8101 angular.min.js:19Ac @ VM8101 angular.min.js:20(anonymous function) @ VM8114 angular-onsenui.min.js:2 VM8101 angular.min.js:6 Uncaught Error: [ng:btstrpd] http://errors.angularjs.org/1.4.3/ng/btstrpd?p0=%26lt%3Bhtml%20class%3D%22ng-scope%22%26gt%3B(anonymous function) @ VM8101 angular.min.js:6d @ VM8101 angular.min.js:19Ac @ VM8101 angular.min.js:20(anonymous function) @ VM8114 angular-onsenui.min.js:2
###該当のソースコード
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta http-equiv="Content-Security-Policy" content="default-src * data:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> <script src="components/loader.js"></script> <script src="lib/angular/angular.min.js"></script> <script src="lib/onsenui/js/onsenui.min.js"></script> <script src="lib/onsenui/js/angular-onsenui.min.js"></script> <link rel="stylesheet" href="components/loader.css"> <link rel="stylesheet" href="lib/onsenui/css/onsenui.css"> <link rel="stylesheet" href="lib/onsenui/css/onsen-css-components.css"> <link rel="stylesheet" href="css/style.css"> <script> ons.bootstrap() .controller('HelloController', function() { this.world = 'World'; }); ons.ready(function() { console.log("Onsen UI is ready!"); }); ons.bootstrap() .controller('HelloController', function($scope, $http) { var config = { params: { value1: '1', value2: '2' } } $http.get('http://example.info/index.php', config) .success(function(data) { $scope.results = data.data; }) .error(function() { alert('Fail to get information'); }); }); </script> </head> <body> <ons-page ng-controller="HelloController as hello"> <ons-toolbar> <div class="center">Introduction</div> </ons-toolbar> <section style="margin: 10px;"> <p>What is your name?</p> <p> <ons-input modifier="underbar" ng-model="hello.world" placeholder="Your name" float></ons-input> </p> <p> Hello, {{ hello.world || 'stranger' }}! </p> </section> </ons-page> </body> </html>
###どうも「https」から「http」への通信がきない、というようなエラーなような気がするのですが、
解決方法がわからないのでご教授いただけますでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/17 05:47
2016/08/17 06:08