从ionic到php获取所选下拉列表值
我是爱奥尼亚的新手,对使用ajax不太熟悉,在下拉列表中获取所选值时遇到问题,我想使用ajax将其保存在数据库中 我在爱奥尼亚的观点有3个选项值从ionic到php获取所选下拉列表值,php,mysql,angularjs,ajax,ionic-framework,Php,Mysql,Angularjs,Ajax,Ionic Framework,我是爱奥尼亚的新手,对使用ajax不太熟悉,在下拉列表中获取所选值时遇到问题,我想使用ajax将其保存在数据库中 我在爱奥尼亚的观点有3个选项值 20分钟、30分钟和1小时 我想使用ng模型获得所选的值。这是包含我的服务的代码 var returnRecipeData = {}; return { AddRecipe: function(thisrecipe){ $http.post('http://localhost/admin
20分钟、30分钟和1小时 我想使用ng模型获得所选的值。这是包含我的服务的代码
var returnRecipeData = {};
return {
AddRecipe: function(thisrecipe){
$http.post('http://localhost/admin-recipick/home/ajaxUserRecipe', thisrecipe).then(function(result){
console.log(result);
}, function(err){
console.error('ERR', err);
});
}
这是我的控制器
$scope.newRecipe={};
$scope.AddRecipe = function() {
console.log("Adding Recipe");
UserRecipeList.AddRecipe($scope.newRecipe);
//console.log($scope.signupdata);
//var registerThis = StudentList.register($scope.signupdata);*/
if(UserRecipeList.AddRecipe){
console.log("Recipe Added Successfully");
$scope.login();
$ionicPopup.alert({
title: 'Recipe Added Successfully!'
});
}
else{
$ionicPopup.alert({
title: 'Failed to Add! Please Try Again!'
});
}
。。最后,我想使用ajax将所选值发布到我的sql数据库中
$data = array('Recipe_ID' => null,
'Recipename' => $post->name,
'Ingredients' => $post->ingredients,
'Cookingtime' => $post->ctime,---> this is the part where i want to post the value to my database. but getting an error.
'Procedure' => $post->procedure,
'user_id' => 1
);
$this->db->insert('UsersRecipes', $data);
echo json_encode($this->db->insert_id());
}
。。。但我有内部服务器错误。。请帮助..尝试从第三方工具(如PostAndy)调用web服务,您是否看到我的代码中有错误?