Skip to navigation
Ajax request with _xsrf
25.12.14
jQuery.ajax({ url: "http://"+ data.base_url + "/ajax", type:'POST',data:{'id':_id,_xsrf : getCookie("_xsrf"),}, success:function(res) { jQuery("#sales").autocomplete({source: res.values}); } }); function getCookie(name) { var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); return r ? r[1] : undefined; } jQuery.postJSON = function(url, args, callback) { args._xsrf = getCookie("_xsrf"); jQuery.ajax({url: url, data: jQuery.param(args), dataType: "text", type: "POST", success: function(response) { var funcCall = callback + "('" + response + "');"; var ret = eval(funcCall); }}); };
http://www.tornadoweb.org/en/stable/guide/security.html?highlight=ajax
Reply
Anonymous
Information Epoch 1746841344
Live free or die.
Home
Notebook
Contact us