Welcome Guest, Not a member yet? Register   Sign In
JQuery post parameters do not get to my controller
#3

Thanks a lot casa.
I've tried setting csrf_protection to false, but same result.
Since this->post is still available in the model, I am retrieving all data and do processing in the model itself.
The problem is that the parameters don't even reach that stage. $_POST is always empty at the start of the method: array(0) { }
What I also don't understand is that even with csrf protection on, if I manually go to http://localhost/index.php/user_filters/create?name=aa from a browser, the following goes through fine:
array(1) { ["name"]=> string(2) "aa" }
Shouldn't this be csrf protected?

Thanks.


(04-06-2015, 10:53 AM)casa Wrote: Perhaps put in your config file $config['csrf_protection'] = FALSE;
If its at TRUE, your are in codeigniter userguide a method with CSRF but i don't try it at this day.
link : http://www.codeigniter.com/userguide3/li...token_name

Then, you need to get your data in your controller :

PHP Code:
function create()
{
var_dump($_POST);
$this->form_validation->set_rules('new_loc_loc_name''Address''required|urldecode'); // tues on your data

if ($this->form_validation->run() == TRUE)
{
 
   // get your data
 
   $name $this->input->post('new_loc_loc_name'TRUE) ; // TRUE for xss_clean
 
   // call your method
 
   $this->users_model->filter_create$name);  // you need to pass your param in your model method and build it for it
}
else
{
$this->load->view('filters/test');

Reply


Messages In This Thread
RE: JQuery post parameters do not get to my controller - by talad - 04-06-2015, 04:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB