Use Shortcode on Custom Page

How to use shortcode on a custom page in a theme? Let say I have a page that has a jQuery ajax function. I am able to send the data via jquery post on my_form.php page. On confirm.php page, I want to use a shortcode from Contact Form DB plugin. Below are the codes that I made,


// Include all the theme functions    

<form name="season-form" class="form-horizontal" method="post" action="">
  <div class="form-group form-group-lg">
    <label for="carNo" id="label-cust"> Vehicle Registration No</label>
    <input type="text" class="form-control" name="vehicle_no" id="vehicle_no" placeholder="BHK1991">
  <div class="form-group form-group-lg">
    <label for="email" id="email">Email</label>
    <input type="email" class="form-control" name="email" id="email" placeholder="">
  <button type="submit" class="btn btn-primary" id="submit_payment">Make Payment</button>
<div id="result"></div>

<?php get_footer(); ?>


jQuery(document).ready(function($) {
        var str = $("form[name=season-form]").serialize();
            type: "POST",
            url: url_to_confitm.php,
            data: str 


    $vehicle_no = $_POST['vehicle_no'];
    $email = $_POST['email'];

    echo "Your Data: <br>$vehicle_no <br>$email<p />";

echo do_shortcode('[cfdb-table form="season parking form_copy"]');
  1. I am able to get the result of post data but the shortcode appears to be nothing.
  2. If I use the shortcode on my_form.php page, it display the data perfectly.

Read more here: Use Shortcode on Custom Page

Leave a Reply

Your email address will not be published. Required fields are marked *