2011-08-04 22 views
1
window.onload= function(){ 
    var page = window.location.hash; 
    if(window.location.hash != ""){ 
     page = page.replace('#page:', ''); 
     getdata('src/'.page); 
    } 
} 

ウィンドウがロードされた後、ページにURLが表示され、#が設定されているかどうかが確認されます。 DIVの中に表示します。たとえば、リンクは<a href="page.php#page:contact.php">link</a>となります。だから、Somenoneがリンクをクリックすると、そのページはcontact.phpからのデータを考えて取得し、div内に配置します。しかし、今、これは動作していません。エラーなし、警告なし、何もありません。助けてください?ありがとう!URLから特定のページを取得し、AJAXでデータを取得する

編集:函:

function getdata(file){ 

    openloading(); // loading message 

    $('#content').fadeOut('slow', function() { // Content is the div where all the content must be in 
     $.get(file, function(data) { 
      $('#content').html(data); 
      $('#content').fadeIn('slow'); 
     }) 
    }) 

    updateusersonline(); 
} 

とupdateusersonlineは、()に直接余りに:

function updateusersonline(){ 
    $.get('src/usersonline.php', function(data3) { 
     $('#usersonline').html(data3); 
    }) 
+0

すべきですか? – Lance

+3

'getdata( 'src /'。ページ);' getdata( 'src /' + page); ' – Joe

+0

@Lanceが追加しました! – Thew

答えて

1

getdata('src/'.page);はあなた `函()`関数がどのようなものに見えるんgetdata('src/' + page);

関連する問題