[eluser]MungeGerard[/eluser]
Hi all,
I'm building my 1st website with CI and I must say, it's really great!
At this point I'm programming an Ajax(jQuery) / Controller combination to submit my forms. But I just can't figure out how to return a value from the codeigniter controller to the javascript function that calls the controller.
Javascript function
Code:
$.ajax({
type: "POST",
url: sUrl,
data: sData,
success: function(response) {
alert(response);
}
});
CI controller
Code:
function send() {
if($this->session->userdata('session_id')==$_POST['sVerification']){
if($this->email->send()){
$result = 'send';
}
else {
$result = 'error';
}
}
else {
$result = 'sessionerror';
}
print_r($result);
return($result);
}
I summarized the scripts, I only included the lines that matter
Everything works fine, only no data gets returned to the javascript.
Hope you guys can help me out here,
Gerard