Here is my code.
<form id='user'>
<label for="name">Name :</label>
<input type="text" id="name" name="name"/>
<label for="email">Email :</label>
<input type="text" id="email" name="email"/>
<input type="submit"/>
</form>
<div id="output"></div>
jQuery:
$('#user').on('submit',function(event){
event.preventDefault();
var data=$(this).serialize();
adddetails(data);
});
function adddetails(data){
var url='http://localhost/projectname/index.php/users/adddat';
$("#output").load(url,data,function(response,status){
});
}
In the 'users' controller
function adddat(){
$name=$this->input->post('name');
$email=$this->input->post('email');
echo "name: ".$name." and email: ".$email;
}
Here when I click on submit the output div is shown like this
name: and email:
Here I am not getting the post data of name and email. Could anyone suggest me an idea.