Ajax(加载功能)问题

I wanted to use ajax to make my website open links without refreshing whole webside (only content in 1 div is changing, header/footer/navigation is always the same).

In header I added js:

    <script type="text/javascript" src="js/general.js"></script>

Index.php looks like this:

<?php
    include '/gui/header.php'; 
    include '/gui/nawigacja.php'; 
?>

<div id="content"></div>

<?php include '/gui/footer.php'; ?>

And the general.js looks like this:

$(document).ready(function(e) {
    $('#content').load('content/main.php');

    $('ul#slider li a').click(function() {
        var page = $(this).attr('href');
        $('#content').load('content/'+ page + '.php');
        return false;
    });

    $('ul#menu li a').click(function() {
        var page = $(this).attr('href');
        $('#content').load('content/'+ page + '.php');
        return false;
    });
});

It worked well on localhost (xampp), but when I wanted to move it to remote free server to tests, the load function didn't work (website didn't won't to load at all, but when I deleted "$('#content').load('content/main.php');" it started to load, but then my ajax didn't load content, because there were no ajax).

Is there any way to solve this problem? Would be gratefull for any kind of help.

Your JS looks fine, I guess that the URL path is not proper. Make it relative to the root directory by adding / in front of content.

$(document).ready(function(e) {

  $('#content').load('/content/main.php');

  $('ul#slider li a').click(function() {
    var page = $(this).attr('href');
    $('#content').load('/content/'+ page + '.php');
    return false;
  });

  $('ul#menu li a').click(function() {
    var page = $(this).attr('href');
    $('#content').load('/content/'+ page + '.php');
    return false;
  });
});

Maybe the problem is with cache. ? Try it:

var d1 = new Date();
var cache = d1.getTime();
$('#content').load('/content/main.php?cache=' + cache);