I have a Pyrocms view where I call a controller method using jQuery Ajax, like this
$('#search').click(function(){
var ionum =$('#ionum').val();
var csrf_hash_name = $('input[name=csrf_hash_name]').val();
$.ajax({
type:"POST",
url:"admin/ads/filter",
data:"ionum="+ionum+"&csrf_hash_name="+csrf_hash_name,
success:function(html){
alert(html);
}
})
return false;
});
but is not working Every time it returns an error like this
An Error Was Encountered [ 500 ] Unable to load the requested file: default.html
My controller method is just echoing a simple string i just want it work after that i will implement my logic controller method is as follows
public function filter(){
$ionum = $this->input->post('ionum');
echo $ionum;
}
Actually i think its the csrf messing i have written it like that
data:"ionum="+ionum+"&csrf_hash_name="+csrf_hash_name,
by reordering it like this make it works
data:csrf_hash_name="+csrf_hash_name"+"&ionum="+ionum,
i wasted my four hours, i was wondering that there is something else that is making problem but its just the ordering issue.