WordPress同步插件的JavaScript操作部分。 function wp2wppush(postId){var ajaxurl = $('#ajaxurl').val();var data = {postId:postId,action:'push'};$.ajax({url:ajaxurl,data:data,type:'POST',dataType:'json',beforeSend:function(){$("#sync
function wp2wppush(postId){ var ajaxurl = $('#ajaxurl').val(); var data = {postId:postId,action:'push'}; $.ajax({ url:ajaxurl, data:data, type:'POST', dataType:'json', beforeSend:function(){ $("#sync-content").html("Loding...."); }, success:function(msg){ if(msg.status==200){ // if(msg==200){ // alert(msg.status); $("#sync-content").html("当前文章同步成功!").css({"margin-bottom":"10px","border":"1px dashed gray"}); }else{ var html = "同步失败!"; html+=" "+msg.msg+" "; $("#sync-content").html(html).css("margin-bottom","10px"); } }, error:function(msg) { html="Sorry,unknown error."; $("#sync-content").html(html); } }) }