codeigniter csrf protection with ajax
- by Yarandi
i have a small problem here which i cannot fix,This post goes through but the response returns a “500 internal server error”
who to fix it?
JS in view:
function load(value)
{
var utype = value;
if(utype>0)
{
new Ajax.Request('<?php echo base_url().'another/load';?>'+'/'+utype,
{
method:'post',
onSuccess: function(transport){
var response = transport.responseText || "no response text";
if(response!="no response text")
document.getElementById('prog_id').innerHTML = response;
},
onFailure: function(){ alert('Something went wrong ...') }
});
}
error in firebug :
An Error Was Encountered
The action you have requested is not allowed.
when i change CSRF protection to False in config file its work for me.but i want protect this request with CSRF enabled.
after search in CI forum i found this this link codeigniter-csrf-protection-with-ajax but i cant solve by it.can any one help me?