﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>FusionCharts Forum / FusionCharts v3 / Using FusionCharts / JavaScript Problems  / Chart not working properly with Ajax in Firefox / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>FusionCharts Forum</description><link>http://www.fusioncharts.com/forum/</link><webMaster>support@fusioncharts.com</webMaster><lastBuildDate>Fri, 10 Oct 2008 17:11:33 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>I have done extensive work with AJAX and fusion charts.&lt;br&gt;&lt;br&gt;&lt;br&gt;The first tricky part, you need to double escape the string after the url base path.&lt;br&gt;&lt;br&gt;&lt;br&gt;function draw_chart(debug) {&lt;br&gt;[code]&lt;br&gt;&lt;br&gt;       var chart = new FusionCharts("/charts/MSStackedColumn2DLineDY.swf", "DynamicChart", "1000", "650",debug, "1");&lt;br&gt;       query = "/cgi-bin/FusionChart.py?xml=/server/path/to/file/test.xml";&lt;br&gt;       chart.setDataURL( escape( query) );&lt;br&gt;       chart.render("fusion_chart");&lt;br&gt;[/code]&lt;br&gt;}&lt;br&gt;&lt;br&gt;You have to create span tag with "fusion_chart" as the id/name for the above code to work.&lt;br&gt;But this is what I have been using to generate the page.&lt;br&gt;&lt;br&gt;Notice the "1" at the end of the new FusionCharts object.&lt;br&gt;This registers your chart object so you can update it via ajax.&lt;br&gt;&lt;br&gt;function UpdateChart(type,path,query,w,h,debug) {&lt;br&gt;&lt;br&gt;      // this function will do an update using Ajax, the data is much more reliable&lt;br&gt;      // trying to redraw the graph any other way spits back the XML incorrectly&lt;br&gt;      try {&lt;br&gt;           if(debug == undefined) {&lt;br&gt;              debug=0;&lt;br&gt;           }&lt;br&gt;&lt;br&gt;       var url = path;&lt;br&gt;       var pars = query;&lt;br&gt;       var myAjax = new Ajax.Request(&lt;br&gt;               url,&lt;br&gt;               { &lt;br&gt;                method: 'get',&lt;br&gt;                asynchronous: 1,&lt;br&gt;                parameters: pars ,&lt;br&gt;                onSuccess: function(request) {&lt;br&gt;                   //alert(url);&lt;br&gt;                   //alert(pars);&lt;br&gt;                   $('fusion_chart').setAttribute("class","");&lt;br&gt;                   var req = request.responseText.evalJSON(); &lt;br&gt;                   var chart1 = new FusionCharts(type, "DynamicChart", w, h, debug, "1");&lt;br&gt;                   //alert(req);&lt;br&gt;                   chart1.setDataXML( escape(req) );&lt;br&gt;                   chart1.render("fusion_chart");&lt;br&gt;                }});&lt;br&gt;&lt;br&gt;      } catch(e) {&lt;br&gt;          alert("ERROR UpdateChart: " + e);&lt;br&gt;      }&lt;br&gt;   &lt;br&gt;}&lt;br&gt;&lt;br&gt;(Can't seem to get the Code tags to work, don't understand why this works on other sites and never really works here)&lt;br&gt;&lt;br&gt;I think you may need to check the chart object to see if it exists before creating it again.&lt;br&gt;But my experience with the chart object is that its sometimes does not register. I abonded trying to reuse the object and just kept re-creating it everytime I needed a new update.&lt;br&gt;&lt;br&gt;Another solution I came up with, does not really require ajax, is using an IFRAME with noborder, and update the the SRC to a path so that it draws the chart through a CGI script. &lt;br&gt;&lt;br&gt;&lt;br&gt;My py CGI script takes a path, resolves it internally and responds with XML output.&lt;br&gt;If you have lots of arguments, this can get tricky passing data around.&lt;br&gt;But it is important that the path for the XML generation is on the same server the AJAX call is running from.&lt;br&gt;&lt;br&gt;Also, you can't do cross-domain AJAX calls, they all have to be local to the server running the webpage displaying the data.&lt;br&gt;&lt;br&gt;Hope this helps,</description><pubDate>Mon, 21 Apr 2008 13:48:12 GMT</pubDate><dc:creator>tcraigen</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>The setDataXML method is not being invoked on chart. Else, the debug mode would write something like:&lt;br&gt;&lt;br&gt;setDataXML method invoked on chart.&lt;br&gt;New data: XML data here...</description><pubDate>Tue, 08 Apr 2008 22:21:34 GMT</pubDate><dc:creator>Pallav</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>anyone?  I still haven't figured out this Firefox problem.</description><pubDate>Fri, 04 Apr 2008 09:22:07 GMT</pubDate><dc:creator>nemesis256</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>I turned on debug mode, but I'm not sure what I'm looking for.  There's no difference in how the chart behaves in Firefox.  It's loaded initially with the debugger on top, and nothing changes when I select another chart from the drop down.&lt;br&gt;&lt;br&gt;Here's the data from the debugger.&lt;br&gt;&lt;br&gt;Info: Chart loaded and initialized.&lt;br&gt;Initial Width: 550&lt;br&gt;Initial Height: 350&lt;br&gt;Scale Mode: noScale&lt;br&gt;Debug Mode: Yes&lt;br&gt;Application Message Language: EN&lt;br&gt;Version: 3.0.6&lt;br&gt;Chart Type: Scroll Column 2D Chart&lt;br&gt;Chart Objects: &lt;br&gt;BACKGROUND&lt;br&gt;CANVAS&lt;br&gt;CAPTION&lt;br&gt;SUBCAPTION&lt;br&gt;YAXISNAME&lt;br&gt;XAXISNAME&lt;br&gt;DIVLINES&lt;br&gt;YAXISVALUES&lt;br&gt;HGRID&lt;br&gt;DATALABELS&lt;br&gt;DATAVALUES&lt;br&gt;TRENDLINES&lt;br&gt;TRENDVALUES&lt;br&gt;DATAPLOT&lt;br&gt;TOOLTIP&lt;br&gt;VLINES&lt;br&gt;LEGEND&lt;br&gt;SCROLLPANE&lt;br&gt;&lt;br&gt;INFO: XML Data provided using dataXML method.&lt;br&gt;XML Data: proper xml data is shown, to long to post here.&lt;br&gt;</description><pubDate>Mon, 31 Mar 2008 10:02:36 GMT</pubDate><dc:creator>nemesis256</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>Can you switch the debug mode of chart to on to see if the method is being invoked on the chart?</description><pubDate>Sun, 30 Mar 2008 14:21:01 GMT</pubDate><dc:creator>Pallav</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>I am getting the response back.  When I alert it I see the correct XML.  It's not being applied to the graph for some reason.  But the same function works when the page is initially loaded.</description><pubDate>Sat, 29 Mar 2008 09:15:23 GMT</pubDate><dc:creator>nemesis256</dc:creator></item><item><title>RE: Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;Could you please try installing Firebub in Firefox to track whether AJAX request is been sent and whether ajax response has been received? This might help you track the issue. Since its working in Safari and IE it seems ok and it should work in Firefox unless some AJAX response handler code is no working.&lt;/P&gt;&lt;P&gt;You could also try alerting the response HTML  to see if AJAX resonse is received in Firefox.</description><pubDate>Sat, 29 Mar 2008 00:54:51 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>Chart not working properly with Ajax in Firefox</title><link>http://www.fusioncharts.com/forum/Topic5320-35-1.aspx</link><description>So I've got this function that has ajax code, which calls to a PHP script to build the XML for the chart. The function is run when the page loads, and is called later when the user selects an option from a select menu. Safari and IE are working fine.  Firefox on the other hand, only works on the page load.  When selecting an option from the select menu, nothing happens.  Is this a known issue?</description><pubDate>Fri, 28 Mar 2008 16:29:17 GMT</pubDate><dc:creator>nemesis256</dc:creator></item></channel></rss>