1 pièce(s) jointe(s)
XHR finished loading: POST “http://localhost/ProjetWeb/src/insererclient.php”
bonjour,
j'ai un problème d'appeler mon fichier php à partir de client AngularJS, voici l'erreur:
Pièce jointe 171517
addclient.html:
Code:
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
| <div class="wrapper-md" >
<tabset class="tab-container">
<tab ng-controller="FrmController">
<ul>
<li class="err" ng-repeat="error in errors">{{error}}</li>
</ul>
<ul>
<li class="info" ng-repeat="msg in msgs">{{msg}}</li>
</ul>
<tab-heading>
Coordonnées
</tab-heading>
<div id="parent" id="ng-view">
<ul class="list-group no-borders pull-in m-b-none">
<li class="list-group-item">
<div id="left">
<div class="form-group">
<label class="col-sm-1 control-label">Nom:</label>
<div class="col-sm-1">
<input type="text" class="form-control rounded" style="
width: 154px;
padding-left: 1px;
padding-right: 1px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
" ng-model="username">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label" style="
padding-left: 200px;
">Adresse:</label>
<div class="col-sm-1">
<input type="text" class="form-control rounded" style="
width: 344px;
padding-left: 1px;
padding-right: 1px;
margin-left: 50px;
margin-right: 0px;
margin-top: 0px;
" placeholder="Adresse de facturation" ng-model="useradresse">
</div>
</div>
<p id="social-buttons" class="ng-scope" style="
margin-left: 875px;
">
<button class="btn m-b-xs w-xs btn-info btn-rounded" ng-click='usersave();' >Valider</button>
<button class="btn m-b-xs w-xs btn-info btn-rounded" ui-sref="app.client">Annuler</button>
</p>
</tab>
... |
app.js:
Code:
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
| angular.module('app', [
'ngStorage',
'ui.router',
'ui.bootstrap',
'ngRoute',
'pascalprecht.translate'
]).controller('FrmController', ['$scope', '$http' ,function($scope,$http) {
$scope.errors = [];
$scope.msgs = [];
$scope.usersave = function() {
$scope.errors.splice(0, $scope.errors.length); // remove all error messages
$scope.msgs.splice(0, $scope.msgs.length);
$http({method: 'POST', url: 'insererclient.php','uname': $scope.username, 'adresse': $scope.useradresse, 'email': $scope.useremail})
.success(function(data, status, headers, config){
if (data.msg != '')
{
$scope.msgs.push(data.msg);
}
else
{
$scope.errors.push(data.error);
}
}).error(function(data, status) { // called asynchronously if an error occurs
$scope.errors.push(status);
});
}
}]); |
merci pour l'aide