The Blog

If your website only uses JSON in AJAX, use this to protect it. Posted on

$.ajaxSetup({
dataFilter: function (data, type) {
var json_data = {};
try {
json_data = $.parseJSON(data);
} catch (e) {
json_data['invalid_token'] = 1;
}
if (json_data.invalid_token == 1) {
window.location.href = '{{ path('SOME_PATH') }}';
}
return data;
}
});
This entry was posted in Uncategorized. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code