$("body").on('click', '.name', function(e) {
//var valueofbutton = $(this).val();
$.ajax({
type: "POST",
url: "response",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
});
my response controller
Class Response extends CI_Controller{
public function index()
{
$data=$this->input->post('name');
echo $data;
}
}
it shows me some errors i dont know what kind of error is it !
my alert gives this information
Data Saved: <br />
<b>Warning</b>: Unterminated comment starting line 25 in <b>C:\xampp\htdocs\vacationgod\application\controllers\response.php</b> on line <b>25</b><br />
John
and i cant see any print information like john
which i pass to response controller
Just change your ajax code.Controller is ok.
$("body").on('click', function(e) {
$.ajax({
type: "POST",
url: '<?=base_url("controller_name/function_name") ?>',
data: {name: "John",location:"Boston"},
success: function(response) {
alert("Data Saved: " + response);
}
});
});