[eluser]bleu[/eluser]
[quote author="bleu" date="1333611197"]I am using the below code to get values through ajax.
When I disable csrf it posts properly , but when I turn csrf true it gives me 500 error
Any Ideas as to how I can solve this?
Code:
[removed]
$(document).ready(function(){
$("#btn").click(function () {
$("#ur").css('display:none;');
$.ajax({
type: "POST",
data: "data=" + $("#Code").val()+",csrf_token_name="+ $("input[name=csrf_test_name]").val() ,
url: "http://www.xyz.com/getit/Click",
success: function(msg){
$("#content").html(msg)
}
});
});
});
[removed]
[/quote]
I did it like this
Code:
$.ajax({
type: "POST",
url: "http://www.xyz.com/getit/Click",
data: "data=" + $("#Code").val()+"&csrf;_test_name="+ $("input[name=csrf_test_name]").val() ,
// data: form_data,
success: function(data) {
alert('it worked');
}
});
});
I added &csrf;_test_name instead of ,csrf_test_name