Last active
March 28, 2018 17:54
-
-
Save anialamo/6ec61799b279a38d80180764dffeb98c to your computer and use it in GitHub Desktop.
Clean or reset form with codeigniter after use set_value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I use AjaX, I tried these functions: | |
------------- JS -------------------------------- | |
$('body').on('click','.register .clean',function(e){ | |
$.ajax({ | |
url: 'acceso-usuario/limpiar', | |
type: 'post', | |
success: function (response) { | |
console.log("La llamada ajax fue con éxito!"); | |
}, | |
error: function(xhr, status, error) { | |
console.log("Ocurrió un error: " + error); | |
}, | |
}); | |
}); | |
------------------ ROUTES---------------------------------- | |
$route['acceso-usuario/limpiar']['post'] = 'users/clear_form_data'; | |
------------------ CONTROLLER ----------------------------- | |
class Users extends CI_Controller { | |
.... | |
public function clear_form_data() | |
{ | |
unset($_POST); | |
$this->form_validation->clear_field_data(); | |
$this->index(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment