在同一域上使用jquery ajax调用进行后期调用时,错误403被禁止

时间:2019-06-25 07:29:09

标签: php jquery html ajax cpanel

我有一个网页( mainmenu.php ),该网页具有javascript函数作为脚本。 Java脚本函数名称为:statusHistoryUpdate(status)

此函数对与我的网页位于同一域的php文件进行ajax发布调用。这是功能代码:

                    function statusHistoryUpdate(status)
                    {


                           var data = {
                                reg_no: selectedRegNo,
                                status: status,
                                progress_id : selectedProgress
                            };
                            data = $(this).serialize() + "&" + $.param(data);
                          //alert(data);
                          $.ajax({
                          type: "POST",
                          dataType: "json",
                          url: "../db/statusHistory.php", //Relative or absolute path to response.php file
                          data: data,
                          beforeSend: function(){

                            $('#loading').toggle();
                            //$("#submitbutton").html( "<button id='buttonsubmit' class='btn btn-primary btn-lg btn-block' type='submit' value='Register' disabled> <span class='spinner-border spinner-border-md'></span>Loading..</button>");
                          },
                          success: function(data) {

                              getData();
                          },
                          complete: function(){
                            //$('.ajax-loader').css("visibility", "hidden");
                            $('#loading').toggle();

                          },
                           error: function(xhr, status, error) {
                            alert(xhr.responseText);
                          }
                        });
                    }

您将看到我发布的网址为url: "../db/statusHistory.php"

使用 mainmenu.php 中的按钮调用此功能。

<button id="'.$progress_id.'" type="button" class="btn btn-primary btn-sm btn-block" onclick="updateStatus('.$progress_id.',\''.$status.'\',\''.$reg_num.'\')">Update Status</button>

所有这些工作都进行到本周末,但有所更改,现在执行此邮寄呼叫时,出现错误 403 Forbidden ,您没有访问/db/statusHistory.php的权限

这是错误中的警报:ajax调用中的一部分:

enter image description here

我不知道是什么原因造成的,我已经检查了权限,我创建了一个新的php文件来发布,但是它仍然给我同样的错误。

我正在使用php,jquery / 3.4.0在共享托管服务器上托管。 我只能访问共享主机面板“ CPanel”,而不能访问linux服务器。

这是我的托管目录和权限的屏幕截图。我的 mainmenu.php 在目录 phplogin 中, mainmenu.php statusHistory.php 发帖,在目录 db

公共html目录: enter image description here

phplogin目录: enter image description here

数据库目录: enter image description here

我的上班后上班时间应该怎么做?正如我所说的,它工作了大约一个月,然后才停了下来。

任何帮助将不胜感激。

Chrome开发者工具的更多屏幕截图:

网络标签: enter image description here

enter image description here enter image description here enter image description here

2 个答案:

答案 0 :(得分:0)

如果它以前曾经工作过,则应检查.htaccess文件,该文件位于网站的根目录中。

答案 1 :(得分:0)

我已经努力了2天,试图找出问题所在,结果发现问题是mod_security我为我的域禁用了mod_security并且问题得到解决,我将与托管公司联系并请他们妥善处理进行设置。

不确定为什么它刚刚开始发生。

相关问题