hey i'm trying to login through a popup window. but i couldn't validate the popup and i'm currently using codeigniter. I want to validate my popup login window, which contain email and pswd fields.
<div class="modal fade" id="eModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h3 class="modal-title" id="lineModalLabel">My Modal</h3>
</div>
<div class="modal-body">
<form id="loginform" action="<?echo base_url();?>mail/login" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" name="email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" name="password">
</div>
<input type="hidden" id="price_id" name="price_id" value="<?echo $result_set->price_id;?>">
<input type="hidden" id="price_value" name="price_value" value="<?echo $result_set->price_value;?>">
<button type="submit" class="btn btn-default">Submit</button>
</form>
<button id="modaltrigger" name="loginbtn" data-toggle="modal" data-target="#xmpModal" class="btn green btn-success" onclick="get('<?echo $user_id;?>','<?echo $price_id;?>')">ok</button>
function get(user_id,user_id)
{
$.ajax({
url: "<?echo base_url()?>mail/mailset",
type: 'post', // HTTP METHOD
data:
{user_id:user_id,price_id:price_id },
success: function(data)
{
if(data==1)
{
jQuery("#eModal").modal('show');
}
else if(data==2)
{
//jQuery("#eModal").modal('hide');
alert("yaa its ok..");
}
else if(data==3)
{
alert("oops");
}
else
{
jQuery("#eModal").modal('hide');
}
}
});
}
controller
public function mailset()
{
$user_id=$this->input->post('user_id');
$event_id=$this->input->post('price_id');
$temp=$this->session->userdata('user');
$confirm=$this->EM->confirm($price_id,$user_id);
$not_confirm=$this->EM->not_confirm($price_id,$user_id);
if($temp=="")
{
$d=1;
echo $d;
}
else if($confirm==$user_id)
{
$d=2;
echo $d;
}
else if($not_confirm==$user_id)
{
$d=3;
echo $d;
$this->EM->price_updation($price_id,$user_id);
}
else
{
$data=array('price_id'=>$price_id,'confirm'=>$user_id);
$this->EM->set($data);
}
}