2
<input type="text" id="csrval" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<input type="text" id="csname" value="<?php echo $this->security->get_csrf_token_name(); ?>">

I have set csrf name and token value in codeigniter view Now I want to send these values to angularjs method

var tokenval = $('#csrval').val();
$rootScope.csrftokenval = tokenval;
var tokenname = $('#csname').val();
$rootScope.csrftokenname = tokenname;

//data: JSON.stringify({csrf_test_name:$rootScope.csrftokenval,page:page})

Not working for me ?? any solution ??

1 Answer 1

1

Using only the first input, you can get the name and value attributes this way:

# Name
$("#csrval").attr('name');
# Value
$("#csrval").attr('value');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.