Я создал небольшое приложение, в котором я отправляю только один район имя поля в базе данных с помощью PHP MySQL - мой app.js файл имеет код -не могут размещать данные - Ионные Framework
angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope,$http) {
$scope.insertdata = function(){
console.log($scope.district);
$http.post('insert.php',{'district':$scope.district})
.success(function(data)
{
console.log("Done");
})
} });
и index.html имеет
<body ng-app="todo" ng-controller="TodoCtrl">
<form>
<input type="text" ng-model="district"/>
<input type="button" value="submit" ng-click="insertdata()"/>
</form>
и insert.php имеет:
$data = json_decode(file_get_contents("php://input"));
$districtname = mysql_escape_string($data->district);
mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("Insert into districtapp (districtname) Values ('".$districtname."')");
Я установил codova белый список и добавил эти строки :
<access origin="*"/>
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
Я бегу приложение, ионную служить и получить:
Ошибка: POST http://192.168.2.152:8100/insert.php 404 Not Found
Может кто-нибудь пожалуйста, помогите мне решить эту проблему проводки?
Можете ли вы получить доступ к URL-адресу в своем браузере? Или вы можете ПОСТ к нему с завитом? – 23tux
yes i can @ 23tux –
Включили ли вы плагин с белым списком? https://github.com/apache/cordova-plugin-whitelist – 23tux