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

[eluser]www.sblog.in[/eluser]
You can do like below

You have a form with hidden input field which holds csrf token value

Code:
<form id="form" name="form" acti method="post">
<?php echo form_hidden($this->security->get_csrf_token_name(), $this->security->get_csrf_hash()); ?>
<input type="text" name="string" />
</form>

Then in ajax you can call

Code:
var cct = $("input[name=csrf_token_name]").val();
var token = $('#form').serialize();
var url = 'http://localhost/mysite/index.php/welcome/ajax_cart';
var data = 'ids='+string,
$.ajax({
                type: "POST",
                //async: false,
                url: url,
                data: data,
                dataType: "html",
                cache: false,
                csrf_token_name: cct,
                success: function(resp) {
                    alert(resp);
                }
            });


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