Code: Select all
function submitSettings() {
$('.forms').each(function() {
posted = $(this).serializeArray();
});
console.log(posted);
console.log('<?php echo $this->session->data["token"]; ?>');
// $.post('<?php echo $action; ?>', posted);
$.ajax({
type: 'POST',
url: 'index.php?route=module/my_module/test&token=<?php echo $this->session->data["token"]; ?>',
data: posted,
dataType: 'json',
success: $('#text-me').html(<?php echo $success; ?>),
error: function(jqXHR, textStatus, errorThrown){
// log the error to the console
console.log("The following error occured: " + textStatus, errorThrown);
}
});
}
test() is located right after index() and this is what it looks like:
Code: Select all
public function test() {
// $this->load->library('json');
// $json['success'] = 'This is the returned results from color_adjust.php';
$this->data['success'] = 'This is the returned result';
$this->response->setOutput($this->render());
}