Sign in to follow this  

Error Loading Data With Escaped Url, Javascript & Php

Recommended Posts



I am currently evaluating FusionWidgets for purchase. I am getting an "error loading data" message when calling the setdataURL method on my chart. I have seen the many posts here regarding URL encoding and it seems to me like I am doing that correctly. Everytthing works fine if I put the created XML into a file and reference that in the setdataURl method or if I hard code the paramters in my getdata.php page and just put the name getdata.php in the setdataURL method call.

When I use escape() around my URL string I get an error loading data.


Here is my code:


 		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 		<title>Labor Analysis</title>
	<script language="JavaScript" src="Charts/FusionCharts.js"></script>
	<form name="dropdown">				  		
		<p>Store: <!-- Drop-down Box queries Stores table in laboranalysis -->
		<?php dropdown('StoreNumber', 'StoreNumber', 'store', 'StoreNumber', 'store1', 'UpdateChart()'); ?>
		  Date: <!-- Drop-down Box queries Punchdetail table in laboranalysis -->
		<?php dropdown('date', 'date', 'available_dates', 'date', 'date1', 'UpdateChart()', '%m/%d/%y'); ?>
<div id="chartdiv" align="center">
	The chart will appear within this DIV. This text will be replaced by the chart.
		<script type="text/javascript">
		var myChart = new FusionCharts("Charts/Gantt.swf", "myChartId", "680", "480", "0", "1");

                       function UpdateChart() {
			var URL = "getdata.php";
			var encodedURL = escape("getdata.php?store=" + document.dropdown.store1.value + "&date=" + document.dropdown.date1.value); 




I through an alert in the code to look at the URL after it has been encoded and it looks fine to me.


Any help would be greatly appreciated.



Share this post

Link to post
Share on other sites

As an update to others, I found the problem to be the : in the time. Even after running it through escape() it did not work. I removed the time (didn't really need it there) and everything was fine.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this