send mail when user click on button in codeigniter

i have one view page for candidates..so in that i gave one button for REQUEST CONTACT INFO..so when user click on this button i need to send mail..

When user click on button i just gave one popup like your request is confirmed..then user will click on ok...then poup will closed..

Here is my button code:

<td><button type="button" class="btn btn-info" onclick="getConfirmation();"><b>REQUEST CONTACT INFO</b></button></td>


<script type="text/javascript">

        function getConfirmation(){
           var retVal = confirm("your request is confiremed ?");
</script>

Here is my controller code:

public function user_view_candidates()

{ 

    $data['view_candidates'] = $this->CandidateModel->getcandidates();
    $this->load->view('Candidates/user-view-candidates',$data);
}

Can anyone help me how to do this..i know how to send mail..

I want to know when user click button how to send mail..

Can anyone help me..

Answers 1

  • Use this:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jque??ry.min.js"></script>
    <script>
       function getConfirmation(){
        var retVal = confirm("your request is confiremed ?");
        if(retVal) {
            $.ajax({
                url:'tothemailfunction',
                success:function(data){
                }
            });
        }
    </script>
    

Related Articles