[eluser]Unknown[/eluser]
I'm trying to get my form working with Ajax.
The code of my Jquery looks like this
Code:
$(document).ready(function() {
$('#inschrijfform').submit(function(e){
$('#errors').hide();
e.preventDefault();
$.post($(this).attr('action'),$(this).serialize(),function(data){
//console.log(data);
if (data.status){
$('#errors').html(data.msg).fadeIn('slow').css({'color':'green', 'border':'1px solid green', 'padding':'20px', 'display': 'inline-block'});
} else {
$('#errors').html(data.msg).fadeIn('slow').css({'color':'red', 'border':'1px solid #FF3333', 'padding':'20px', 'display': 'inline-block'});
}
}, 'json');
});
});
my controller likes this:
Code:
function send($titel = "")
{
$this->load->library('form_validation');
$this->load->model("inschrijven_model");
if ($this->form_validation->run('zomerkamp') == FALSE)
{
if(IS_AJAX)
{
$data = array (
'status' => false,
'errors' => validation_errors()
);
echo json_encode($data);
}
else
{
$page_init = array('location' => 'inschrijven_succes');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->render();
}
}
else
{
if($this->inschrijven_model->insert_inschrijving_Zomerkamp())
{
$page_init = array('location' => 'inschrijven');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->render();
}
else
{
echo "Inschrijving ging fout";
}
}
}
When I using Firebug I can see the form values are beeing posted but the response get an error. I got and internal server error what saying: An Error Was Encountered
Unable to locate the file: includes/template.php
Does someone know what this mean?