[eluser]seegan[/eluser]
Hi friends and brothers,
plz help me...
when i use like below its working fine (without passing data)..
Code:
<div id='result_table'>
</div>
.....script type='text/javascript' language='javascript'....
$('#getdata').click(function(){
$.ajax({
url: '<?php base_url() ?>message/sam',
type:'POST',
dataType: 'json',
success: function(output_string){
$('#result_table').append(output_string);
} // End of success function of ajax form
}); // End of ajax call
});
....script....
controller function
------------------------
Code:
{
$data = 'success';
echo json_encode($data);
}
---------------------------------------------------------------------------------------
But when i use like below its not working.. (passing with data)
Code:
<div id='result_table'>
</div>
.....script type='text/javascript' language='javascript'....
$('#getdata').click(function(){
var name= "johns";
$.ajax({
url: '<?php base_url() ?>message/sam',
type:'POST',
dataType: 'json',
data: { name: name },
success: function(output_string){
$('#result_table').append(output_string);
} // End of success function of ajax form
}); // End of ajax call
});
....script....
controller function
------------------------
Code:
{
$name = $this->input->post('name');
echo json_encode($name);
}
also i tried wit some other methods but did'nt got the result..
friends plz i need your help..