I'm making an ajax call to the controller:
$.ajax({
url: base_url + "user/removeIngredientFromRecipe",
type: "POST",
data: { 'deleted_ingredients`': deleted_ingredients },
success: function() {
console.log("Deleted " + deleted_ingredients);
},
error: function(status, responseText) {
console.log(status + ": " + responseText)
}
});
I'm posting "deleted_ingredients", it's an array of integers.
Controller code:
function removeIngredientFromRecipe()
{
$data = $_POST;
$this->db->where_in('recipe_ingridient_id',$data['deleted_ingredients'])->delete('recipe_ingridients');
return TRUE;
}
I've verified that the array has the correct integers, the delete statement works from the mySQL console.
I can see that the URL is being called from the apache logs: 66.194.3.158 - - [16/Dec/2013:19:57:50 +0000] "POST /user/removeIngredientFromRecipe HTTP/1.1" 200 26
and it returns an HTTP 200. In mySQL- I'm logging all queries, and I never see the delete statement hit the db. This leaves me thinking that I'm making it to the controller, but have my delete function configured incorrectly, or possibly don't have something loaded. Any thoughts on what I'm missing/did wrong?
FYI- the misspellings of 'ingredient' are intentional and correct, legacy code from previous developers. :(
Not the world's strongest PHP dude, so no suggestion unwelcome.
Thanks!