Welcome Guest, Not a member yet? Register   Sign In
Including More Data in an AJAX Post with CSRF Enabled
#1

[eluser]Doulos[/eluser]
OK, So here's the javascript, I have 9 Elements I need to POST at the same time with Ajax, 1 of which is the CSRF token.
Code:
tx = $("tx"+working_row).val;
mods = $("mods"+working_row).val;
pos = $("pos"+working_row).val;
startdate = $("startdate"+working_row).val;
enddate = $("enddate"+working_row).val;
fordx = $("4dx"+working_row).val;
qty = $("qty"+working_row).val;
price = $("price"+working_row).val;
token = $.cookie("csrf_cookie_name")

obj = {'csrf_token_name': token, 'tx': tx};

$.post("index.php/auth/fee_schedule",obj, function(data){
     alert(data);
});

So, I'd like to include them all in the obj variable and throw that in the call, but whenever I add anything to the obj variable, say 'tx':tx it gives me error 500 Not Allowed. With only the CSRF token in the Obj variable it works just fine.

What am I missing?

thanks!
#2

[eluser]Doulos[/eluser]
Problem was my inability to use the value function from Jquery correctly. Needed () after each .val.




Theme © iAndrew 2016 - Forum software by © MyBB