Php 提供空响应的Ajax成功函数

Php 提供空响应的Ajax成功函数,php,jquery,ajax,wordpress,Php,Jquery,Ajax,Wordpress,我有这个剧本: <script type="text/javascript"> jQuery(document).on("click",".pending-post-approve-link",function(e){ jQuery('#review_post_status').val('approve'); var globalVar = jQuery(this).find(

我有这个剧本:

        <script type="text/javascript">
            jQuery(document).on("click",".pending-post-approve-link",function(e){

                jQuery('#review_post_status').val('approve');

                var globalVar = jQuery(this).find('.review_post_id').val();
                jQuery('#review_post_current_id').val(globalVar);

                jQuery('#post-preloader-'+globalVar).fadeIn(500);

                $.fn.wpjobusSubmitFormFunction();

            });

            $.fn.wpjobusSubmitFormFunction = function() {

                var globalVar = jQuery('#review_post_current_id').val();

                jQuery('#wpjobus-pending-posts').ajaxSubmit
                ({
                    url: '<?php echo admin_url('admin-ajax.php'); ?>',   
                    data: jQuery('#wpjobus-pending-posts').serialize(),
                    type: "POST",
                    success: function(response)
                    {
                        jQuery('#post-preloader-'+response).fadeOut(100);
                        jQuery('#post-'+response).fadeOut(100, function()
                        {
                            jQuery(this).css('display', 'none');
                        });
                        return false;
                    }
                });
            }

        });

        </script>

jQuery(文档)。在(“单击“,”上。挂起后审批链接),函数(e){
jQuery('review#u post_status').val('approve');
var globalVar=jQuery(this).find('.review_post_id').val();
jQuery('#review_post_current_id').val(globalVar);
jQuery('#post preload-'+globalVar).fadeIn(500);
$.fn.wpjobusSubmitFormFunction();
});
$.fn.wpjobusSubmitFormFunction=函数(){
var globalVar=jQuery('#review_post_current_id').val();
jQuery(“#wpjobus挂起的帖子”).ajaxSubmit
({
url:“”,
数据:jQuery(“#wpjobus挂起的帖子”).serialize(),
类型:“POST”,
成功:功能(响应)
{
jQuery(“#后预加载程序-”+响应).fadeOut(100);
jQuery(“#post-”+response).fadeOut(100,function()
{
jQuery(this.css('display','none');
});
返回false;
}
});
}
});
当这个脚本运行时,它给我空的响应。我不知道是什么导致了这个问题。这发生在ajax的success函数中
success:function(response)

任何帮助都将不胜感激。

您可能已经完成了其中的一些步骤,但我本人会采取这种方法来发现问题:

  • 使用Google Chrome console或Firebug for FF等工具检查您的请求是否发送到预期的url,以及是否得到预期的响应
  • 如果没有得到预期的响应,那么问题就出在服务器端,您应该查看那里。您还可以使用相同的工具(console/firebug)设置一些断点,以查看所传递的参数是否符合预期(您也可以检查POST头的详细信息)
  • 最后,您可以尝试在success函数上放置一个断点,以确保它得到执行,并且响应是空字符串,而不是其他内容

我希望这有帮助。

这就是我得到的。如果响应为空,您需要检查负责处理此请求的PHP代码,以了解为什么响应仍然为空。这个问题很可能是服务器端的问题,与处理响应的方式无关。