[eluser]Unknown[/eluser]
while processing a form with an Ajax call to one of my controller function then it will show a notification inside a div i need to display this notification message which already included with the design with special css format ..
i though it can be done through rendering the notifications view which i split it from the main design
i tried to do like this ..
Code:
public function add ()
{
$data = array();
if (!empty($_POST)) {
$this->model->insert();
$this->load->view('dashboard/notification', $data);
exit;
}
$this->load->view('dashboard/categories', $data, FALSE);
}
but sadly it didn't work and nothing appear ..
when i printed a simple message to show if everything working normally it shows up the message and print it normally ..
Code:
public function add ()
{
$data = array();
if (!empty($_POST)) {
$this->model->insert();
echo 'message';
exit;
}
$this->load->view('dashboard/categories', $data, FALSE);
}
and this is the jquery script
Code:
$(document).ready(function() {
$("#addCatgory").validate({
rules: {
categoryname: {
required: true,
minlength: 5
},
categoryslug: {
required: true,
minlength: 5
},
categorytype: {
required: true,
min : 1
}
},
messages:{
categoryname : 'Please enter your name',
categoryslug : 'Please enter a valid email',
categorytype : 'Please enter a valid type'
},
submitHandler: function(form) {
$(form).ajaxSubmit({
type: "POST",
async: false,
data: $("#addCatgory").serialize(),
success: function(data){
$('#result').html(data);
},
error: function(){alert('error');}
});
}
});
});