Pavlos1316 Posted May 26, 2011 Share Posted May 26, 2011 Hello, I am trying to make all my scripts external but I have hit on some problems with jquery. I have this: $(document).ready(function(){ $('#headerlinks > a').click(function(){ $("#content").empty(); var page = $(this).attr("id"); $('#content').load("../loop_a.php?page="+ page); }); It is working when have it inside my <head> tags but when I call it as an ext.js file is not That's how I call it: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="help_scripts/lnks_in_trgt_div.js"></script> Any ideas? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/ Share on other sites More sharing options...
gizmola Posted May 26, 2011 Share Posted May 26, 2011 Here is what you want to do rather than specifying the protocol. It needs to be done before your $(document).ready of course, which is probably why yours is not working: Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220483 Share on other sites More sharing options...
Pavlos1316 Posted May 26, 2011 Author Share Posted May 26, 2011 nope... this isn't it... still doesn't work... Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220490 Share on other sites More sharing options...
gizmola Posted May 26, 2011 Share Posted May 26, 2011 Let's see your code. You need to explain what "doesn't work" means. Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220495 Share on other sites More sharing options...
hemo-ali Posted May 26, 2011 Share Posted May 26, 2011 Sure we must see your code because the code above is very correct Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220500 Share on other sites More sharing options...
Pavlos1316 Posted May 26, 2011 Author Share Posted May 26, 2011 ok... here it is my index.php: <?php // check for all errors require_once('help_scripts/check_all_errors.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled</title> <link rel="stylesheet" media="all" type="text/css" href="style.css" /> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="help_scripts/lnks_in_trgt_div.js"></script> </head> <body> <div id="all"> <div id="header"> <?php require_once('template_header.php'); ?> </div> <div id="content"> <?php require_once('p_arxiki.php'); ?> </div> <div id="footer"> <?php require_once('template_footer.php'); ?> </div> </div> </body> </html> And my lnks_in_trgt_div.js $(document).ready(function(){ $('#headerlinks > a').click(function(){ $("#content").empty();//katharizei ta periexomena tou div me id=content var page = $(this).attr("id");//pairnei to periexomeno tou id pou klikares $('#content').load("loop_a.php?page="+ page);//stelnei to periexomeno tou id sto loop_a.php kai gyrna to apotelesma sto div me id=content }); $('#footerlinks > a').click(function(){ $("#content").empty(); var page = $(this).attr("id"); $('#content').load("loop_a.php?page="+ page); }); $('#bodylinks > a').click(function(){ $("#content").empty(); var page = $(this).attr("id"); $('#content').load("loop_a.php?page="+ page); }); }); my links are in the header template... Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220503 Share on other sites More sharing options...
gizmola Posted May 26, 2011 Share Posted May 26, 2011 Have you looked at the net panel in firebug when the page is loading and checked out what is happening? Are you seeing jquery loading? Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220792 Share on other sites More sharing options...
Pavlos1316 Posted May 26, 2011 Author Share Posted May 26, 2011 Hello, I think is solved... I say I think because my cache/cookies are playing games with me... Problem was on my path to loop_a.php WHICH I was trying with all possible ways and never worked (I clean my cache every time that I change something). Any other change that I was making was coming out. My loop_a... NEVER. After 2 hours (and after I was 99.9% sure that it was my path and cache), I cleaned my cache once more, made sure that my path was the right one closed all pages down and restarted my ie ------ guess what... it worked. I hope it continues that way Sorry for putting you in trouble. Thank you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/237505-jquery-not-working-as-an-external/#findComment-1220803 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.