javascript - Why do only some of my js work when I switch cases with php? -


i cannot figure out life of me why of js works.

i using switch-case in php files.

both "content_allinboxes.php" , "content_emails.php" can recognize "app.v2.js".

however, "content_allinboxes.php" uses "jquery.ui.touch-punch.min.js" & "jquery-ui-1.10.3.custom.min.js" aren't recognized.

what doing wrong? have been @ hours , can't figure out.

(note: 2 javascript files works if not put "content_allinboxes.php" in switch-case.)


here how switch contents called:

<div id="displayloading"><img src="images/account/loading_indicator.gif"/></div> <div id="displaycontent" style="height: 100%; width: 100%"></div> 

here switch-case codes. file called "content_load.php":

<?php switch($_get['id']) {     case 'feeds_allinboxes':         $content = 'content_allinboxes.php';         break;     case 'feeds_emails':         $content = 'content_emails.php';         break;     case 'feeds_chats':         $content = 'test_print.html';         break;     case 'feeds_phones':         $content = 'test_print.html';         break;     default:         $content = 'test_print.html'; }   include($content); ?> 

here javascript runs switch-cases. file called "switchcontent.min.js":

document.observe('dom:loaded', function () {     var switches = document.getelementsbyclassname('switches');     (var = 0; < switches.length; i++) {         $(switches[i].id).onclick = function () {             getcontent(this.id);         }     } });  function getcontent(id) {     var url = 'pages/content_load.php';     var rand   = math.random(9999);     var pars   = 'id=' + id + '&rand=' + rand;     var myajax = new ajax.request( url, {method: 'get', parameters: pars, onloading: showload, oncomplete: showresponse} ); }  function showload () {     $('displaycontent').style.display = 'none';     $('displayloading').style.display = 'block'; }  function showresponse (originalrequest) {     var newdata = originalrequest.responsetext;     $('displayloading').style.display = 'none';     $('displaycontent').style.display = 'block';             $('displaycontent').innerhtml = newdata; } 

here footer javascripts:

<script src="js/app.v2.js"></script> <script src="js/switchcontent.js"></script> <script src="js/switchcontent.min.js"></script> <script src="js/jquery.ui.touch-punch.min.js" cache="false"></script> <script src="js/jquery-ui-1.10.3.custom.min.js" cache="false"></script> 

<script src="js/jquery-ui-1.10.3.custom.min.js" cache="false"></script> <script src="js/jquery.ui.touch-punch.min.js" cache="false"></script> <script src="js/switchcontent.min.js"></script> <script src="js/switchcontent.js"></script> <script src="js/app.v2.js"></script> 

reverse order of javascript source adding, first add jquery min, jquery ui touch, other js filles reference in js , js.

ps: check browser console see error details.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -