3
私は簡単なAjaxリクエストを行い、応答ステータスは "200、ok"です。私はJSONを検証することができます。大丈夫です...しかし、http httpは必ず失敗します。 私は非常に単純なJSONを入れようとしていますが、とにかく同じ結果があります。
$http.get('http://127.0.0.1:8000/produto/')
.then(function successCallback(response) {
console.info('success =)');
console.info(response);
// this callback will be called asynchronouslywhen the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
console.info('fail =(');
console.info(response);
});
私のJSONの結果が、[]のような単純な応答を持つ: ソリューションは私
- Ajax request returns 200 OK, but an error event is fired instead of success
- Angular JS using $http() get a response, with status 200, but data is null
マイANGUJAR JS要求のために動作しません。私は同じ問題を抱えていた:
[{"id":1,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 13:23:49","updated_at":"2016-04-26 13:23:49"},{"id":2,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 13:24:25","updated_at":"2016-04-26 13:24:25"},{"id":3,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 13:24:46","updated_at":"2016-04-26 13:24:46"},{"id":4,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 13:25:16","updated_at":"2016-04-26 13:25:16"},{"id":5,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 13:28:06","updated_at":"2016-04-26 13:28:06"},{"id":6,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 18:05:15","updated_at":"2016-04-26 18:05:16"},{"id":7,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 18:52:42","updated_at":"2016-04-26 18:52:43"},{"id":8,"nome":"NOME UPD","doce":"1","deleted_at":null,"created_at":"2016-04-26 20:29:43","updated_at":"2016-04-26 20:29:43"}]
タンクがたくさんあります。
次の構文を試すことができますか? http://jsbin.com/fofariziga/edit?js,output .catchブロックからのエラー応答を追加してください。 –
同じ... status = 0、data = null、statusText = "" – cmnardi
何ですかサーバー側のルートは次のようになります。 – MarkoCen