[eluser]predat0r[/eluser]
Hi,
I use JQueryUI Autocomplete on my page for search purposes. If I include the csrf cookie data to the ajax call, it doesn't pass the typed parameter, only the csrf data. I don't know much about JQuery but maybe someone saw similar problem during CI development..
CSRF switched OFF - Firebug console says: (and term "asus" passed to the php script well)
term = asus
CSRF switched ON:
[object Object]
csrf_test_name 23d8bf447d1d3d8825d2080fd87f4475
So some way it don't takes the parameter to my php script.
The ajax code:
Code:
$(function() {
$(".term").autocomplete({
source: function(req, add){
var cct = $.cookie('csrf_test_name');
param = '&csrf;_test_name='+cct;
console.log(req+param);
$.ajax({
url:base_url+'shop/autocomplete',
dataType: 'json',
type: 'POST',
data: req+param,
success: function(data){
if(data.response =='true'){
add(data.message);
}
}
});
},
minLength: 2,
select: function(event, ui){
$(this).end().val(ui.item.value);
}
});
});
Any idea? Thank you