homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Issue on download button
Gowri pandiyan




msg:4665453
 9:14 am on Apr 24, 2014 (gmt 0)

Hi Gurus,

I'm using amchart in my page, here viewers can download the result which is shown in a pie chart. Its working great in all browsers as I expected,But not in IE11 :(.

I couldn't figure out the solution. Kindly help me out to find a solution for this issue.

Here is the code.

<p class="Three-Dee1">Your result:</p>


<div id="chartdiv"></div>
<img id="image1" src="http://www.cross-tab.us/geetanjali/BMI/Combo/hand3.png">


<script type="text/javascript" src="http://www.cross-tab.US/geetanjali/BMI/Combo/amcharts.js"></script>
<script type="text/javascript" src="http://www.cross-tab.US/geetanjali/BMI/Combo/pie.js"></script>
<script type="text/javascript" src="http://www.cross-tab.us/geetanjali/BMI/light.js"></script>

<script type="text/javascript" src="http://www.cross-tab.us/geetanjali/BMI/Combo/amexport_combined.js"></script>

<style>
.Three-Dee{
Position:relative;
bottom: 20px;
left: 10px;



font-family: Segoe UI Light;
line-height: 1em;
color: #7FBA00;
font-weight:bold;
font-size: 25px;

}



.Three-Dee1{

font-family: Segoe UI Light;
line-height: 1em;
color: #C94F00;
font-weight:bold;
font-size: 35px;

}


#chartdiv {#chartdiv {
width: 100%;
height: 400px;
font-size: 11px;
font-family:Segoe UI Light;
}
width: 100%;
height: 400px;
font-size: 11px;
font-family:Segoe UI Light;
}</style>

<script>
function button_click()
{
if(document.getElementById('chartdiv')!=null){document.getElementById('chartdiv').style.display='inline';}


}


var chart = AmCharts.makeChart("chartdiv", {
"type": "pie",

"theme": "light",
"marginBottom": 0,
"height": 350,
"fontFamily": "Segoe UI Light",
"legend": {
"markerType": "circle",
"valueText": "$[[value]]",
"position": "right",
"marginRight": 80,
"fontFamily": "Segoe UI Light",
"autoMargins": false
},

"dataProvider": [{

"country": "Books",

"litres": 22


}, {
"country": "e-Books",
"litres": 33
}, {
"country": "Research requests",
"litres": 44
}, {
"country": "Chat",
"litres": 33
}],
"valueField": "litres",
"titleField": "country",
"labelText": "[[title]] $[[value]] ([[percents]]%)",
"balloonText": "[[title]] $[[value]]([[percents]]%)",
"exportConfig": {
"menuTop":"0px",
"menuRight":"125px",
"menuItems": [{
"icon": 'http://www.cross-tab.US/geetanjali/BMI/Combo/download3.png',
"format": 'png'
}]
}
});





</script>

 

Gowri pandiyan




msg:4665454
 9:15 am on Apr 24, 2014 (gmt 0)

Only download is creating problem here...

Fotiman




msg:4665485
 11:39 am on Apr 24, 2014 (gmt 0)

What happens in IE11? Does it show an error?

Gowri pandiyan




msg:4665486
 11:47 am on Apr 24, 2014 (gmt 0)

Nothing is happening....If I click the download button, It doesn't respond....downloading is not working

Fotiman




msg:4665507
 1:32 pm on Apr 24, 2014 (gmt 0)

I'd try opening IE's developer tools and see if you can spot anything unusual (JavaScript errors, etc.). Unfortunately, I don't have access to AmCharts.

Gowri pandiyan




msg:4665548
 4:19 pm on Apr 24, 2014 (gmt 0)

Thanks Fotiman!

I tried opening in IE's developer tool,It shows there is a syntax error in the below line.

if(window.DOMParser)return(new DOMParser).parseFromString(b,"text/xml");

Please let me know what could be the issue here

Fotiman




msg:4665555
 4:27 pm on Apr 24, 2014 (gmt 0)

Try adding some space around the "return":
if(window.DOMParser) return (new DOMParser).parseFromString(b,"text/xml");

Gowri pandiyan




msg:4665560
 4:41 pm on Apr 24, 2014 (gmt 0)

Still it is throwing syntax error in the below line

if(window.DOMParser) return (new DOMParser).parseFromString(b,"text/xml");

Fotiman




msg:4665563
 4:55 pm on Apr 24, 2014 (gmt 0)

the "new DOMParser" is missing parenthesis. Try this:

if(window.DOMParser) return (new DOMParser()).parseFromString(b,"text/xml");

If that doesn't work, I'd try splitting it up into multiple lines to better identify what exactly is causing the problem:


if (window.DOMParser) {
var _newdp = new DOMParser();
var _parsedresult = _newdp.parseFromString(b, "text/xml");
return _parsedresult;
}

Gowri pandiyan




msg:4665572
 5:26 pm on Apr 24, 2014 (gmt 0)

Thanks for help!

It throws syntax error from the below line now

var _parsedresult = _newdp.parseFromString(b, "text/xml");

Fotiman




msg:4665583
 5:39 pm on Apr 24, 2014 (gmt 0)

Is it possible that your variable b doesn't contain properly formatted XML, and maybe the error you're seeing is coming from trying to parse it?

Gowri pandiyan




msg:4665586
 5:44 pm on Apr 24, 2014 (gmt 0)

I just read the below in a website

Internet Explorer uses the loadXML() method to parse an XML string, while other browsers use the DOMParser object.

So code become as below

if (window.DOMParser) {
var _newdp = new DOMParser();
var _parsedresult = _newdp.parseFromString(b, "text/xml");
return _parsedresult;
}

else // Internet Explorer
{
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
var parse1 = xmlDoc.loadXML(b);
return parse1;
}

But I'm getting syntax error from the below line. :( Please correct me if I'm wrong

var _parsedresult = _newdp.parseFromString(b, "text/xml");

Fotiman




msg:4665595
 5:50 pm on Apr 24, 2014 (gmt 0)

IE has supported DOMParser since IE9.
[msdn.microsoft.com...]

So IE8 and older won't work with the DOMParser method, but IE9+ should work. Check to see that b contains valid XML.

Gowri pandiyan




msg:4665615
 6:02 pm on Apr 24, 2014 (gmt 0)

I couldn't figure out whether b contains valid XML....

The below line contains the original code....Could you please take a look into this?

[cross-tab.us...]

Fotiman




msg:4665630
 6:17 pm on Apr 24, 2014 (gmt 0)

I can't tell from that if your xml is valid, but what you could do is add a breakpoint on the line that does parseFromString, then in the "Locals" tab, examine the value of b, maybe copy it and paste it into an XML validator.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved