Search code examples
javascriptjquerypage-refreshpartial-page-refresh

Partially refreshing site not working


I am trying to refresh just a part of my website (the left part in which a list with topics appear), but it don't work for me. I get a very weird screen on that left part if I click the refresh button. The script I am using is this:

$(function() {
   $("#refresh").click(function(evt) {
      $(".bgleft").load("left.php")
      evt.preventDefault();
   })
})

The weird screen I am getting is a white blank screen with a random text on it (that does not exist). I don't understand why it is happening. For a live example: go to (edited out) and click on "refresh" at the left frame.

Edit:

The HTML snippet: <body class="bgleft">


Solution

  • In left.php there are two lines of code which are showing theese characters.

    for(var n = 1; n < 7; n++)
    document.write(String.fromCharCode(Math.round(Math.random()*25)+97));
    

    Try to remove them, it should help.

    Also as sad in other answers send only contents of <body> in response because scripts are already included in the site.