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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.