1

Ajax からそれぞれの都市データを表示する都市タブの ajax コードを作成しました。

次のコードを使用しました:

function showBrandData(str)
    document.getElementById("dvloader").style.display = 'block';                                
    jQuery('#txtDisplayBrands').slideDown("slow");

    if (str=="")
    {
        document.getElementById("txtDisplayBrands").innerHTML="";
        return;
    }
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("dvloader").style.display = 'none';
            document.getElementById("txtDisplayBrands").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","http://localhost/demostore/getBrandData.php?q="+str+"&page=1",true);
    xmlhttp.send();
}

以下は、ajaxコンテンツの上にロードする私のdivです

  <!-- div to display brands products -->
    <div id="txtDisplayBrands"></div>

今、私は次の jquery プラグインを使用してアイテムをページ分割しました http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination

しかし、これをajax応答で使用すると、ページネーションが機能しません。

私が間違っているところを教えてください。

ありがとうございます。それでは、お元気で

4

1 に答える 1

0

そのサイトのデフォルト コード:

<script type="text/javascript">

  jQuery(function($){ 
  $('ul#items').easyPaginate();
  }); 

</script>

ページの読み込み時に呼び出されます。その後、ajax呼び出しが実行されるため、ajax呼び出しでロードする要素でページネーションコードを呼び出す必要があります。

if ステートメント内に追加することを検討してください if (xmlhttp.readyState==4 && xmlhttp.status==200)

于 2012-06-26T13:11:12.940 に答える