Submit datagram 400badrequest
The front-end code is as follows:
<p ng-controller="faultInsCtrl">
<h1>xxx</h1>
<label class="label">线路号:</label>
<select class="select" ng-model="data.line_id">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<br><br>
<label class="label">列车号:</label>
<input type="text" class="inputtext" ng-model="data.train_id">
<br><br>
<label class="lable">巡检所在站台:</label>
<input type="text" class="inputtext" ng-model="data.station">
js code:
$scope.data = {
line_id:$scope.line_id,
train_id:$scope.train_id,
station:$scope.station
};
$http({
url: 'http://yiwuyahei.com/api/v1/issues',
method: 'post',
headers: {'Authorization': 'Bearer ' + data.access_token},
data: $scope.data,
})
.success(function (data, status, headers, config)
alert(123);
})
.error(function (data, status, headers, config) {
//
})
})
请大神指导哪里有问题?
400 means parameter error. Check whether the request parameters sent match the requirements of the background interface code~
400 is a parameter error. You should communicate with the backend first
It may be a content-type problem. Ask about the format of the data transmitted in the background. Try adding contentType: "application/json".