Posting an Object with AJAX, CodeIgniter CSRF Enabled
This is in CodeIgniter
Here's the relevant Javascript:
var tx = $("tx"+working_row).val;
var mods = $("mods"+working_row).val;
var pos = $("pos"+working_row).val;
var startdate = $("startdate"+working_row)开发者_开发问答.val;
var enddate = $("enddate"+working_row).val;
var fordx = $("4dx"+working_row).val;
var qty = $("qty"+working_row).val;
var price = $("price"+working_row).val;
var token = $.cookie("csrf_cookie_name")
var obj = {"csrf_token_name": token, "tx" : tx };
$.post("index.php/auth/fee_schedule",obj, function(data){
alert(data);
});
If I remove the "tx":tx from the obj variable it works just fine, but anytime I add anything to that object it returns error 500, not allowed. I'd like to get all 9 variables into that object, but at the moment, can't even get one to work, so where's my typo/screw up/mis-understanding?
Any Suggestions?
thanks!
You aren't calling the val()
method properly, should be:
var tx = $("tx"+working_row).val();
精彩评论