I'm trying to get the value of textbox that has been submitted through ajax, but when i try to get its value inside controller method it return nothing.
Here is my AJAX function and controller method:
jQuery("#frm_xyz").validate({
rules: {
otp: {
required: true
},
....
....
submitHandler: function(form,event) {
event.preventDefault();
var from_url=jQuery(form).attr('action');
jQuery.ajax({
url: from_url,
type: "POST",
data: new FormData(document.getElementById("frm_xyz")),
cache: false,
processData: false,
success: function(data) {
}
});
}
});
HTML:
<?php echo form_open('verify-verification-otp',array('id'=>"frm_xyz")); ?>
<input type="text" name="otp" placeholder="OTP" class="form-control" />
<br />
<input type="submit" name="submit" id="btn_verify_contact" class="btn btn-info" value="Verify OTP" />
<?php echo form_close(); ?>
but when i try to get value of textbox in controller i don't get the value!
PHP:
public function verify_otp()
{
$otp = $this->input->post('otp');
print_r($otp);
die();
}