我正在使用服務來更新數據庫表。
myApp.factory('createGal', function ($http, $q)
{
return {
createGal: function()
{
var deferred = $q.defer();
var newGalleryArray = {};
newGalleryArray.galleryName = 'New Image Gallery';
newGalleryArray.client = 245;
$http.post('/beta/images/create', {newGalleryArray: newGalleryArray}).success(function(data)
{
console.log(data);
deferred.resolve(data);
});
return deferred.promise;
}
};
});
PHP
public function create()
{
print_r($_POST);
}
陣列被返回空。我錯誤地傳遞數組?
Chrome瀏覽器開發
感謝
控制檯對請求的說明是什麼? – tymeJV
成功,請求。返回數據庫操作,只是不在POST中發送的數組 – Bungdaddy
有趣...您的PHP發送回來了什麼? – tymeJV