0

ajax 呼び出しが行われた後に ajaxComplete を使用してプラグインを開始したいので、.load の使用から .ajax への以下の変換に苦労しています。

以下は私が持っている現在のコードです。レンガの壁に到達したので、変換方法についてのガイダンスが必要です。

$('.pbd-alp-placeholder-'+ pageNum).load(nextLink + ' .post',
            function() {



                // Update page number and nextLink.
                                    $( this ).hide().fadeIn(500);
                pageNum++;
                                    nextLink = nextLink.replace(/paged[=].[0-9]*/, 'paged='+ pageNum);

                // Add a new placeholder, for when user clicks again.
                $('#pbd-alp-load-posts')
                    .before('<div class="pbd-alp-placeholder-'+ pageNum +'"></div>')
                $.ajax({});
                // Update the button message.
                if(pageNum <= max) {
                    $('#pbd-alp-load-posts a').text('Load More Posts');
                                            $('#contentWrapper').stellar('refresh');
                } else {
                    $('#pbd-alp-load-posts a').text('No more posts to load.');
                }
            }
        );
4

1 に答える 1

0
 $(element).load( url [, data ] [, complete(responseText, textStatus, XMLHttpRequest) ] )

これに変換することができます

$.ajax(function(){
            url:"",
            data:{},
            complete:function(responseText, textStatus, XMLHttpRequest){
           }
});

これで少しずつ変換できます=)

例:

$("#myelemdiv").load("/not-here.php",{"mydata":"hellodata"} function(response, status, xhr) {

});

このように変換することができます

$.ajax(function(){
            url:"/not-here.php",
            data:{"mydata":"hellodata"},
            complete:function(response, status, xhr){
              $("#myelemdiv").html(response);
           }
});
于 2013-01-17T08:11:24.163 に答える