开发者

Wordpress ajax not returning the result

I'm using the below code for one of my simple work in wordpress plugins.

    $j = jQuery.noConflict();
    $j(document).ready(function(){

    $j.ajax({
    url:"/wp-admin/admin-ajax.php",
    type:"POST",
    data:'action=market_place_posting_display&page='+ page1,
    success:function(data){$j('#mine').html(data);}
    });

    });

The thing is task is working properly but it's not displaying the echo statment . If i do any insert or delete or what ever operations it's doing. But when i try to print the data through the success message it's not displaying! Could any one can guide me , what's the problem here? If i 开发者_Go百科do the same thing normally without wordpress it's working perfectly.


what are you doing in that "data" part ?? OMG!!! grave mistake!!

you should pass real values in the data or
remove data and encode the url yourself and put it in the url.

$j = jQuery.noConflict();
    $j(document).ready(function(){

    $j.ajax({
    url:"/wp-admin/admin-ajax.php?action=market_place_posting_display&page="+ page1,
    type:"POST",

    success:function(data){$j('#mine').html(data);}
    });


$j = jQuery.noConflict();
$j(document).ready(function(){

$j.ajax({
url:"<?php bloginfo('wpurl') ?>/wp-admin/admin-ajax.php",
type:"POST",
data:'action=market_place_posting_display&page='+ page1,
success:function(data){$j('#mine').html(data);}
});

});

The tag bloginfo('wpurl'); was missing!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜