[eluser]MungeGerard[/eluser]
Quote:I hope you see how that works. This is untested since I did it in the browser, if you give it a try and something doesn't work correctly let me know and I'll help debug it.
Thanks for all the help, but the exit method didn't work. I looked at JSON and it seems promising, I found an example and did exactly the same.
Javascript
Code:
var sUrl = ($("input#url").val() + "index.php/contact/send");
var sName = $("input#name").val();
$.post(sUrl, { 'item' : sName },
function(data){
alert(data.result);
}, "json");
Controller
Code:
function send() {
return($result);
$item = '1234'; //trim($this->input->post('item'));
$array = array('result' => $item);
echo json_encode($array);
}
Still no data gets returned to the javascript. When I call the contoller/function directly I get the following output:
So do you have any ideas?