I ran into a problem with codeigniter and jQuery Ajax Post.
My javscript
$('.remove').click(function(){
var category=event.target.id;
var id=$('input[name=article_id]').val();
var p={};
p['id']=id;
$.ajax({
type: "POST",
url: "/backend.php/blog/removeCategories",
async:true,
cache:false,
data: {id: id, category: category }
}).done(function(msg){
jQuery('#category_list').load('/backend.php/blog/refreshCategories/',p,function(str){});
});
My codeigniter controller
function removeCategories(){
$id=$_POST['id'];
$category_id=$_POST['category'];
$this->article->removeCategory($category_id,$id);
}
I can not get the ajax function to work, because there is always a 500 error received from the server. Although firebug returns that there was an error loading resources, the removeCategories function was executed anyway.
source
share