vincej Posted July 3, 2014 Share Posted July 3, 2014 Hi - My app is built with Codeigniter and so if I turn on CSRF on CI inside the config I get the token being created on my page - good. But I have 1 page ( "shopping cart") which uses Scriptaculous Ajax.Updater function : http://api.prototypejs.org/ajax/Ajax/Updater/ When I turn on CSRF my shopping cart page refuses to function in terms of updating the cart or deleting any items from the cart. These are both js functions. I am really stuck - any help would be a God send. Thank You !! Here is the code: UpDate JS Function: function jsUpdateCart(){ var parameter_string = ''; allNodes = document.getElementsByClassName("process"); for(i = 0; i < allNodes.length; i++) { var tempid = allNodes[i].id; var temp = new Array; temp = tempid.split("_"); var real_id = temp[2]; var real_value = allNodes[i].value; parameter_string += real_id +':'+real_value+','; } var params = 'ids='+parameter_string; var ajax = new Ajax.Updater( 'ajax_msg','http://localhost/mysite/index.php/welcome/ajax_cart', {method:'post',parameters:params,onComplete:showMessage} ); } Quote Link to comment https://forums.phpfreaks.com/topic/289390-need-help-using-csrf-in-codeigniter-and-scriptaculous/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.