我面临这个错误,不知道为什么会出现这个错误.我正在使用codeigniter,这是
jquery错误.
这是我的浏览页面
<script> $(function() { $("#accordion").accordion({ collapsible: true,heightStyle: "content" }); }); var data = google.visualization.arrayToDataTable([ ['Attendance Type','Count'],['Present',<?PHP echo $student_attendance_count['present']; ?>],['Absent',<?PHP echo $student_attendance_count['absent']; ?>],['On Leave',<?PHP echo $student_attendance_count['leave']; ?>],['Attendance Not Maked',<?PHP echo $attendance_not_marked; ?>] ]); var options = { title: 'My Daily Activities' }; var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data,options); </script>
这是我的HTML页面检查这个以供参考.如果您需要更多详细信息,我将在此处添加.我不知道这个错误是怎么来的.
<div id="accordion"> <h3><span class="accordion_header">Student Strength</span></h3> <div> <table> <tr> <td> <div id="chart_div" style="width: 500px; height: 300px;"></div> </td> <td style="vertical-align: top"> <table class="list"> <tr> <td style="width: 200px;"><b>Total student</b></td> <td style="width: 50px;" class="text-right"><?PHP echo $total_student_count; ?></td> </tr> <tr> <td class="attendance_color_present"><b>Present</b></td> <td class="text-right attendance_color_present"><?PHP echo $student_attendance_count['present']; ?></td> </tr> <tr> <td class="attendance_color_absent"><b>Absent</b></td> <td class="text-right attendance_color_absent"><?PHP echo $student_attendance_count['absent']; ?></td> </tr> <tr> <td class="attendance_color_leave"><b>Leave</b></td> <td class="text-right attendance_color_leave"><?PHP echo $student_attendance_count['leave']; ?></td> </tr> <tr> <td><b>Attendance Not Marked</b></td> <td class="text-right"><?PHP echo $attendance_not_marked = $total_student_count - ($student_attendance_count['present'] + $student_attendance_count['absent'] + $student_attendance_count['leave']); ?></td> </tr> </table> </td> </tr> </table> </div> <h3><span class="accordion_header">Attendance Details</span></h3> <div> <div class="data_listing" style="margin-left: auto"> <table class="list" align="center" style="margin: 0px auto; width: 70%"> <thead> <tr> <th style="width: 10%; text-align:center">Sr. No.</th> <th style="width: 60%">Class Name</th> <th style="width: 30%; text-align: center">Attendance Status</th> </tr> </thead> <?PHP $i = 1; $attendance_marked = 0; foreach ($class_section_attendance as $class) { if ($class['attendance_marked'] == 1) { $image = '<img src ="' . base_url() . 'resources/images/icons/tick_circle.png" title="Attendance Marked" alt="Attendance Marked"/>'; $attendance_marked++; } else { $image = '<img src ="' . base_url() . 'resources/images/icons/cross.png" title="Attendance Not Marked" alt="Attendance Not Marked"/>'; } echo '<tr>'; echo '<td style="text-align:center">' . $i++ . '</td>'; echo '<td>' . $class['name'] . '</td>'; echo '<td style="text-align:center">' . $image . '</td>'; echo '</tr>'; } $not_marked = count($class_section_attendance) - $attendance_marked; echo '<tr><td colspan="3" style="text-align:center">Total Classes : <b>' . count($class_section_attendance) . '</b> | Attendaced Marked : <b>' . $attendance_marked . '</b> | Not Marked : <b>' . $not_marked . '</b> </td></tr>'; ?> </table> </div> </div> </div>
请帮我.
解决方法
确保正确加载Google Visualization API.
文件在这里:
https://google-developers.appspot.com/chart/interactive/docs/basic_load_libs
你可能需要这样的东西:
<!--Load the AJAX API--> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> // Load the Visualization API library and the piechart library. google.load('visualization','1.0',{'packages':['corechart']}); google.setOnLoadCallback(drawChart); // ... draw the chart... </script>