• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Including More Data in an AJAX Post with CSRF Enabled

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.
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){

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?


Problem was my inability to use the value function from Jquery correctly. Needed () after each .val.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.