Working with HTML and a Free WordPress Site

I noticed that <iframes> work on the free wordpress however <script> tags do not.

  • wordpress.com works a little differently then a normal wordpress site
  • JavaScript <script> tags don’t work on a wordpress.com site
  • there maybe is a <iframe> work around and that topic is discussed in this blog entry
  • the goal is to be able to insert JavaScript right into a wordpress blog post without updating php code

First off what is an <iframe>?

<iframe src="table.php" flex="2" id="browserTable" name="table_frame"/>

Source: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/iframe

<iframe> you will notice gets its source from a different file called table.php.

Google Calendar also uses an <iframe> to insert itself into wordpress and that works.

 

MySQL bridge

Here is an interesting way to send messages to and from MySQL by calling a php file – its suppose to work with Jquery.

 jquery request from html page:

$.ajax({
    url: "messages.php",
    type: "POST",
    async: true, 
    data: { WHAT GOES HERE ? },
    dataType: "html",

    success: function(data) {
        $('#output').html(data);    
    },  
}); //data: {'messagecontent': $("#message-content").val()},

response code:

<!--?php 

$host = "localhost";
$user = "root";
$pass = "root";
$databaseName = "myDataBaseName";
$tableName = "comments";  

$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);

$result = mysql_query("SELECT * FROM $tableName ORDER BY date DESC LIMIT 0 , 10 ");            
$data = array();

while ($row = mysql_fetch_array($result)) 
{
echo $row['message']." - ".$row['date'];
echo "
"; } ?>

Source: http://stackoverflow.com/questions/20392036/send-data-to-mysql-with-ajax-jquery-php

NOTE: There is still some type of jquery code that does a .send() I believe?