[eluser]condoace[/eluser]
I am trying to call a controller method from a jquery AJAX script, everything seems to work fine (i.e. when I check in Firebug the values/varaibles are being posted to the controller) however cant get any of the input variables using $this->input->post(). Check out my code below:
Any ideas would be helpful!?
VIEW
Code:
$(function() {
$("#submit").click(function() {
var name = $("input#name").val();
var email = $("input#email").val();
var company = $("input#company").val();
//alert (dataString);return false;
$.ajax({
type: "POST",
url: '<?php echo base_url().'index.php/launch/form';?>',
data: {'name' : name, 'email' : email, 'company' : company},
success: function() {
$('#contact_form').html("<div id='message'></div>");
$('#message').html("<h2>Contact Form Submitted!</h2>")
.append("<p>We will be in touch soon.</p>")
.hide()
.fadeIn(1500, function() {
$('#message').append("<img id='checkmark' src='images/check.png' />");
});
}
});
return false;
});
});
CONTROLLER
Code:
function form() {
$this->output->enable_profiler(true);
$name = $this->input->post('name');
$email = $this->input->post('email');
$company = $this->input->post('company');
$this->load->model('Model_launch');
if($query = $this->Model_launch->enquiry($name,$email,$company))
{
$this->session->set_flashdata('result','test');
$this->load->view('view_launch',$data);
}
else
{
$this->load->view('view_launch');
}
}