How do I do ajax post in bootstrap modal

I am using Bootstrap to add a dialog modal to my page using the following code.

<!-- Modal -->

But what I dont want is the thank you to go to another page Im wanting the dialog to display a thank you message once the mail has been sent. Its also currenlty saying it cant find the php even though it is in my template directory.

Email Sending code.

//lets get the redem voucher email that will go to both the user and the admin.

$replacements = array(
'({player_id})' => $playerId,  
'({player_fname})'=> $player->display( 'player_first_name' ),
'({player_lname})'=> $player->display( 'player_last_name' ),
'({message_body})' => nl2br( stripslashes(  $ggs['player-redeem'] ) )
);

$message = preg_replace( array_keys( $replacements ), array_values( $replacements ),  $ggs['player-redeem']);


//Handle some basic validation
 $errors = array();


    //Assigning a picture for {logo} replacement

 $headers = 'From: My Name <davidbuckleyni@gmail.co.uk>' . "\r\n";
    //Send the message assigned to a var so we can output

$email= wp_mail( 'test@test.com', 'The subject',$message  );  
var_dump($email);
?>

Edit
BTW I am wanting to do this without moving to another page ie within the modal then let the user close the dialog themselfs

Edit A bit futher

I have got a bit futher but for some reason my overlay modal is now not showing and I dont no why ??.

<li>  <a href="#myModal" role="button" class="btn" data-toggle="modal"><i class="fa fa-hand-peace-o"></i>REDEME POINTS</a>
    <!-- Modal -->





    
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s