Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to display piechart in UIWebview of my ios xcode project, for that I'm using jqplot with HTML, CSS and javascript, the issue I face is javascript file "devicepiechart.js" is loading from the html.

<!DOCTYPE html>

<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
<script>
            function load()
            {
                alert("I am an loading scripts!");
            }
        </script>

<script src="devicepiechart.js"></script>
</head>
<body onload= "load()">
</body>
</html>

The load() function alert is shown properly without any problem. I could detect that my .js file is not loading as I have the alert("string"); function in my .js file too for debugging.

UPDATED devicepiechart.js, and I hope the external .js file may not have any error, because I have the source from this http://www.jqplot.com/tests/pie-donut-charts.php

$(document).ready(function()
      {
              alert("good");
              var data = [
                          ['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],
                          ['Out of home', 16],['Commuting', 7], ['Orientation', 9]
                          ];
              var plot1 = jQuery.jqplot ('chart1', [data],
                                         {
                                         seriesDefaults: {
                                         // Make this a pie chart.
                                         renderer: jQuery.jqplot.PieRenderer,
                                         rendererOptions: {
                                         // Put data labels on the pie slices.
                                         // By default, labels show the percentage of the slice.
                                         showDataLabels: true
                                         }
                                         }, 
                                         legend: { show:true, location: 'e' }
                                         }
                                         );
              });
share|improve this question
1  
If loading inline scripts works but loading script files doesn't, that pretty firmly points to a problem loading the file. (Or, of course, there's a serious error in the external script -- which you haven't shown -- preventing it from being parsed successfully.) –  T.J. Crowder 17 hours ago
1  
Side note: Neither language nor type is necessary. language has been deprecated for well more than a decade. type's default is and always has been text/javascript. So... –  T.J. Crowder 17 hours ago
 
@T.J. Crowder, As u said I have deleted the language and type from my html, even then the same result and I have updated my question by including the javascript file, please refer to it. –  sathya 17 hours ago
 
@T.J.Crowder, while opening my html file in browser, all the alerts are displaying as expected but in xcode ios its not loading, what should be changed for clearing that issue. –  sathya 15 hours ago
add comment

1 Answer

Include jquery before the other js loads

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
share|improve this answer
 
yes, after inserting the code the result is same. –  sathya 17 hours ago
1  
@sathya: It was definitely missing (though why runelynx pointed you at such an out of date version is unclear). Perhaps you added it in the wrong place. It goes before the tag loading your file. –  T.J. Crowder 17 hours ago
 
it's the one I use :) sorry bout that... it works tho ;) –  runelynx 14 hours ago
 
and yes, be sure to put it before all other javascript <scripts> :) –  runelynx 14 hours ago
1  
@runelynx, ya I used before javascripts.Then too the alert in js file is not working. And I was trying to include the devicepiechart.js file in the html file within the <script> tag, then the alert function is working. –  sathya 14 hours ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.