how to popup after ajax "success:"

i have a button, when i clicks this button it will goes to ajax. In the suceess condition,it returns three values for ‘data’ which are 1,2,3. i want to popup a login form only when data=1.(if the user is not logged in). pls help me.

 <button data-toggle="modal" data-target="#xmpModal" class="btn green btn-success" onclick="get('<?echo $u_id;?>','<?echo $e_id;?>')">click</button>

popup div

   <div class="modal fade" id="exmpModal" 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">

                        <!-- content goes here -->
                        <form>
                          <div class="form-group">
                            <label for="exampleInputEmail1">Email address</label>
                            <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputPassword1">Password</label>
                            <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                        </div>

                      <button type="submit" class="btn btn-default">Submit</button>
                  </form>

              </div>
              <div class="modal-footer">
                <div class="btn-group btn-group-justified" role="group" aria-label="group button">
                    <div class="btn-group" role="group">
                        <button type="button" class="btn btn-default" data-dismiss="modal"  role="button">Close</button>
                    </div>
                    <div class="btn-group btn-delete hidden" role="group">
                        <button type="button" id="delImage" class="btn btn-default btn-hover-red" data-dismiss="modal"  role="button">Delete</button>
                    </div>
                    <div class="btn-group" role="group">
                        <button type="button" id="saveImage" class="btn btn-default btn-hover-green" data-action="save" role="button">Save</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

ajax

  function get(u_id,e_id)
{
    $.ajax({

        url: "<?echo base_url()?>events/xyz",
        type: 'post',   // HTTP METHOD
        data:
        {u_id:u_id,e_id:e_id  },

        success: function(data)
        {  

             //alert(data);
            if(data==1)
            {
                // add your code pls
            }
           else if(data==2)

           {
                alert("hai");

           }
           else if(data==3)
           {
             alert("hello");
           }
        }

      });
  }

my function in php controller

    public function xyz()
{
    $u_id=$this->input->post('u_id');
    $e_id=$this->input->post('e_id');
    $temp=$this->session->userdata('user');
    $g=$this->xm->is_going($u_id,$e_id);
    $g1=$this->xm->is_going1($u_id,$e_id);
    if($temp=="")
    {
       $d=1;
       echo $d;

    }
    else if($g==$u_id)
        {

           $d=2;
           echo $d;

        }
        else if($g1==$u_id)
            {

                $d=3;
                echo $d;
                $this->xm->event_updation($e_id,$u_id);
            }
            else
            {
                $data=array('event_id'=>$e_id,'ev_going'=>$u_id);
                $this->xm->eventgoing($data);
     }
   }


Download how.to.popup.after.ajax.success.zip
Direct Link


Download


Download how.to.popup.after.ajax.success.zip
Mediafire


Download


Download how.to.popup.after.ajax.success.zip
Uploadable


Download

Both comments and pings are currently closed.

Comments are closed.