Jump to content

Setting up javascript variables in the parent window in a content area pulled in


cooldude832

Recommended Posts

So I have this bit of code that pulls content into a center column

 

(You can see it working kseego.com click the left column)

 

and I am trying to setup an array of values in the called php script so they are set in the parent document so I can access them.

 

 

The bit of code does this

<?php
if(mysql_num_rows($r) >0){
	echo "<script type=text/javascript'>";
		echo "var events_ids=new Array();";
		echo "var events_dates=new Array();";
		echo "var events_cats=new Array();";
		echo "var events_open=new Array();";
	echo "</script>";
	$i = 0;
	while($row = mysql_fetch_assoc($r)){		write_ebox($row['EventID'],$row['ImageID'],$row['Ext'],$row['Title'],$row['StartDate'],$row['UserID'],$row['Poster'],$row['StartTime'], $row['EndTime'],$i,$row['CatID']);
		$i++;

	}		
}
?>

 

In the write_ebox function I populate those 4 arrays with values using

<?php
echo "<script type=text/javascript'>";
	echo "events_ids[".$i."]='event_div_".$id."'";
	echo "events_dates[".$i."]='".date('j',strtotime($date))."'";
	echo "events_cats[".$i."]='".$cat."'";
	echo "events_open[".$i."]=0";
echo "</script>";
?>

 

However when I look in firebug I don't see those arrays even showing up any ideas on how to do this?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.