Javascript 如何修复错误 POST ... net::ERR_CONNECTION_RESET

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31282698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:28:59  来源:igfitidea点击:

How fix error POST ... net::ERR_CONNECTION_RESET

javascriptphpjqueryajax

提问by Riski Febriansyah

I have a textarea with ckeditor plugins. before, I have no problems using it and the data can be stored properly. but now I get the error "POST" ... path/url ... net :: ERR_CONNECTION_RESET. when I try to enter the process of running a good bit of text. but when I enter a long text and included with some of the code, the error appears. peroses storage I did as follows. p_post.php (form) -> p_post.js (validate) -> f_post.php (insert function).

我有一个带有 ckeditor 插件的 textarea。之前,我使用它没有问题,数据可以正确存储。但现在我收到错误“POST”... path/url ... net :: ERR_CONNECTION_RESET。当我尝试进入运行大量文本的过程时。但是当我输入长文本并包含在某些代码中时,就会出现错误。peroses存储我做了如下。p_post.php(表单)-> p_post.js(验证)-> f_post.php(插入函数)。

The following is a script p_post.js

下面是一个脚本 p_post.js

jQuery(function($) {
    var val_holder;
    $("form input[name='btnsubmit']").click(function() { // triggred click
        val_holder      = 0;
        var txtjudul    = jQuery.trim($("form input[name='txtjudul']").val()); // email field

        if(txtjudul == "") {
            $("span.txtjudul_val").html("Judul tidak boleh kosong.");
        val_holder = 1;
        }
        if(val_holder == 1) {
            return false;
        }

        val_holder = 0;

        $("span.validation").html("");

    var datastring = $('#mainform');            
    datastring.on('submit', function(e) {
    e.preventDefault();



      $.ajax({
      url: 'http://example.com/fungsi/f_post.php',
      type: 'POST',
      dataType: 'html',
      data: datastring.serialize(),
      beforeSend: function() {
      },

                    success: function(e) {
                        if(e == 1) {
                            $("span.txtalert_val").html("Judul, Isi & Tags tidak boleh kosong!!");
                        } else {
                            if(e == 3) {
                                $("form input[type='text']").val('');

                                setTimeout(function(){
                                document.location.reload();
                                },1000);

                                datastring.trigger('reset');
                        }
                        }
                    }
      });
        });
    });
});

and no problem with insert function.

并且插入功能没有问题。

回答by agurodriguez

Those kind of errors are generally generated in the server. You should check for errors in your server.

这类错误通常是在服务器中生成的。您应该检查服务器中的错误。

If you are using Windowswith Apache, Event Viewer Application Logis a good start to gather more info

如果您使用Windowswith Apache事件查看器应用程序日志是收集更多信息的良好开端

In *nixyou should check your web server log.

*nix您应该检查您的网络服务器日志

回答by xinqiu

I solved a weird error that when there are IP address conflict, somehow AJAX post request can receive this kind of error as well.

我解决了一个奇怪的错误,当存在 IP 地址冲突时,不知何故 AJAX 发布请求也会收到这种错误。