Ylama
Ylama

Reputation: 2489

About using JavaScript in .php

I'm really actually just a html/css guy.

I want to insert a booking form on to my page but i got a custom link for adding the form. The link consist of just basic script and I'm told to just copy it onto my html file. The problem is i have to add it to a .php file and when i do and reload my page it shows a blank.

I have a basic div in my .php file and a div for calling an image, then my Script. Can you tell me where my problem is?

 <div id="dine_oliver_cattermole" class="content_holder border"></div>
 <div id="dine_oliver_cattermole" class="content_holder border">
 <table class="chef_holder" width="100%">
    <tr>
        <td width="30%" align="left" class="dine_chef_photo"><img src="/wp-content/.." width="290" height="440" /></td>
        <td width="40%" align="center" class="dine_chef_text">
            <h2>The Tasting Room’s Guiding Principles:</h2>
            <h3>-</h3>
            <h3>Please allow 3½ hours for this menu.</h3><br />
            <p>We do not have a dress code, you dress for the experience you.</p> 
            <p>Only open for dinner Tuesday</p>
        </td>
    </tr>
 </table>
 </div>

<!-- Start Bookatable Code -->
 <script type="text/javascript" src="http://ajax...."></script>
 <script type="text/javascript" src="https://bda...."></script>
<a id="target" href="#">Book Online</a>
<script type="text/javascript">
$(function () { 
    $("#target").lbuiDirect({
       connectionid  :  "LITH",
       popupWindow  :  {enabled  :  true}
    });
});
</script>
<!-- End Bookatable Code -->

Also got his code to use, but displaying blank.

 <!-- Start Bookatable Code -->
    <script type="text/javascript" src="https://bda....."></script>
    <script type="text/javascript">
         LBDirect_Embed({
         connectionid  :  "ZA-RES-THELIVINGROOMATLEQUARTIERFRANCAIS_283714:67970"
     });
    </script>
<!-- End Bookatable Code 

 <div id="dine_oliver_cattermole" class="content_holder border"></div>
 <div id="dine_oliver_cattermole" class="content_holder border">
   <table class="chef_holder" width="100%">
    <tr>
     <td width="30%" align="left" class="dine_chef_photo"><img src="/wp-content/.." width="290" height="440" /></td>
     <td width="40%" align="center" class="dine_chef_text">
        <h2>The Tasting Room’s Guiding Principles:</h2>
        <h3>-</h3>
        <h3>Please allow 3½ hours for this menu.</h3><br />
        <p>We do not have a dress code, you dress for the experience you.</p> 
        <p>Only open for dinner Tuesday</p>
    </td>
</tr>

Upvotes: 0

Views: 270

Answers (1)

Ylama
Ylama

Reputation: 2489

@PalDev @Adder @RiggsFolly Thanks so much, at the end i as you mentioned it looks fine for a html file so i just used the html file coping it into this directory and on one of my page hooks I called the html using an iframe. It called the script succefully.

so my .html file helds the script:

 <!-- Start Bookatable Code -->
  <script type="text/javascript" src="https://bda.book..."></script>
  <script type="text/javascript">
  LBDirect_Embed({
  connectionid  :  "ZA-RES-THELIVINGROOMATLEQUARTIERFRANCAIS_283714:67970"
  });
  </script>
 <!-- End Bookatable Code -->

Then my page.php hooks the following page part_page-info.php which contains the iframe calling my .html file:

    <td width="30%" align="right">
        <iframe style="display: block; width: 100%; height: 404px;" src="/wp-content/theme/leeu/content/leeu-test/tasting-room/test.html"></iframe>
    </td>

This then displays the JavaScript i was looking for.(im just mentioning i think i did not work because all the other pages im not mentioning thats also been called and hooked from page.php has JavaScript interrupting the Script im trying to use).This was my easy solution around it.

Upvotes: 2

Related Questions