Welcome Guest, Not a member yet? Register   Sign In
Disallowed Key Characters
#4

[eluser]vincej[/eluser]
You're right. I added this script years ago and never changed it. It worked, so why bother. Now I am starting to realize that it may be time to change it, but I am nervous about doing that as, it works .. well kind of.

In fact the Ajax.Updater is part of Prototype which of course is part of Scriptaculous.

http://api.prototypejs.org/ajax/Ajax/Updater/


This morning I have tried a new approach, where I pass the csrf_token_name : csrf_token value into the params. This is rejected as well. Google Chrome reports the scope variables as:

Code:
<return>: undefined
ajax: Object
cct: "c037bc424fcca019c7956208b13f4e92"
csrf: "csrf_clftoken"
parameter_string: "4061:1,"
params: "ids=4061:1,csrf_clftoken:c037bc424fcca019c7956208b13f4e92"
real_id: "4061"
real_value: "1"
temp: Array[3]
tempid: "li_id_4061"
this: Window


The script which creates this is:

Code:
function jsUpdateCart(){
  var cct = document.getElementsByName("csrf_clftoken")[0].value;
  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;
var csrf = 'csrf_clftoken';
    parameter_string += real_id +':'+real_value+',';  
  }
  var params = 'ids='+parameter_string+csrf+':'+cct;
  var ajax = new Ajax.Updater(
    'ajax_msg','http://localhost/mysite/index.php/welcome/ajax_cart', {method:'post',parameters:params,onComplete:showMessage}
    );

}


Maybe it would be easier if I throw in the towel and convert to JQuery Ajax. I am thinking that in fact the only thing that would need changing would be the Ajax.Updater piece and I could keep the For loop - Correct ??


Thanks for all your trouble - I am terrible at Javascript.


cheers !


Messages In This Thread
Disallowed Key Characters - by El Forum - 07-09-2014, 11:29 PM
Disallowed Key Characters - by El Forum - 07-10-2014, 02:40 AM
Disallowed Key Characters - by El Forum - 07-10-2014, 08:09 AM
Disallowed Key Characters - by El Forum - 07-10-2014, 11:08 AM
Disallowed Key Characters - by El Forum - 07-10-2014, 11:27 AM
Disallowed Key Characters - by El Forum - 07-10-2014, 12:02 PM
Disallowed Key Characters - by El Forum - 07-10-2014, 10:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB