• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook pagefor updates, or we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.)

[jQuery]No file loaded..

Master Summoner
Joined
Oct 9, 2008
Messages
572
Reaction score
14
Hi,
I'm trying to have a link that goes to "#" to load a file into a DIV with a POST value. But I seem to fail, which seems odd for me (Since I follow the exact steps in the tutorial).

I inserted a line of code where it should change the link from "Index" to "Hello World" and that happens, but it does not load the file.

Heres my source:

HTML:
Code:
<!DOCTYPE html>
<html>
 <head>
  <script type="text/javascript" src="./js/jquery.js"></script>
  <title>Website</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <link rel="stylesheet" type="text/css" href="./style/main.css" />
 </head>
 <body>
  <div id="maincontainer">
   <div id="headercontainer">
   </div>
   <div id="content">
    <div id="menubar">
     <div class="margin">
     <script type="text/javascript" src="./js/menu.js"></script>
     </div>
    </div>
    <div id="content_2"> </div>
    <div id="footer">
     Copyright 2009
    </div>
   </div>
  </div>
  <script type="text/javascript">
   $(document).ready(function() {
       $(".Index").click(function() {
       
         $("#content_2").load("./php/main.php",{page:1});
         $(".Index").text("hello world");

       });

    });



  </script>
 </body>
</html>

my menu:
Code:
var out = new Array('Index','Projects','Contact','About');
for(i = 0; i < (out.length); i++) {
 document.write('<a href="#" class="' + out[i] + '">' + out[i] + '</a><br />'); 
}

and the page it loads: (main.php):
PHP:
<?php

echo "your on page: " . $_REQUEST['page'];


?>

Oh - and my version of jQuery is 1.3.2 (newest)

Thanks in advance, regards,
Andertraaks.
 
Newbie Spellweaver
Joined
Aug 3, 2009
Messages
23
Reaction score
0
You are aware that the ./ is referring to the folder above i assume ? :x
 
Master Summoner
Joined
Oct 9, 2008
Messages
572
Reaction score
14
You are aware that the ./ is referring to the folder above i assume ? :x

Yes. I write ./ to mark that it needs to navigate from the folder this file is located in. Some webservers that needs to work with a link like /php/main.php will use it diffrent than ./php/main.php
 
Back
Top