Page 1 of 1
Strange popup when using URL for fusion charts
Posted: Mon Aug 15, 2016 6:27 pm
by dustinmiles
I have written a PHP script to generate an XML document for a chart on one of my genie screens. When the chart loads, I get a popup box with the message 0 -
It happens every time the page loads. I know the URL is valid because I can copy it into a browser window and it returns my xml document. If I paste the XML into the dynamic chart property, the chart renders exactly as I would expect. What could be the issue with the URL?
Re: Strange popup when using URL for fusion charts
Posted: Tue Aug 16, 2016 4:31 am
by Scott Klement
Dustin,
Its hard to say what may be wrong from this symptom. I would suggest the following:
1) Look in data in the "Network" tab of your browser's developer tools and make sure your PHP is being called and is returning the data in the way you expect.
2) Look for errors in the browsers "Console"
3) Look for errors in the IBM i HTTP server error log
Does any of that provide any useful clues?
Re: Strange popup when using URL for fusion charts
Posted: Tue Aug 16, 2016 8:57 am
by dustinmiles
Yes, good suggestions. The console does give the error message
XMLHttpRequest cannot load [my xml url]. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '[my genie origin]' is therefore not allowed access.
It is adding an auth token to my url. Is this a server config on the chart http server?
Re: Strange popup when using URL for fusion charts
Posted: Tue Aug 16, 2016 9:01 am
by dustinmiles
I was able to solve it by adding header('Access-Control-Allow-Origin: *'); to my php script.
Thank you for the suggestions - once I could see the actual error message it was easy to find the right solution. I don't know why I didn't think to look there, thank you for the nudge in the right direction.