未定义的索引:div 内的外部文件使用加载函数时出现名称错误

Undefined index: name ERROR on external file inside div using load function

正在使用以下代码在 div

中加载外部文件
                   <script type="text/javascript">
                        $(document).ready(function () {
                            $("#load_home").on("click", function () {
                                $("#zaladuj").load("comments.php");
                            });
                        });
                    </script>

           <a href ="#zaladuj" id="load_home"> load</a>

                    <div id="zaladuj">

                    </div>

效果很好 在主页面中,我使用 $_GET['name'] 来获取名称值,我需要将此值传递给在 div 中加载的外部文件,但不幸的是不起作用

Notice: Undefined index: name in C:\Users\sanoj\Documents\NetBeansProjectsvideo_new_template_TEST\comments.php on line 34 Call Stack #TimeMemoryFunctionLocation 10.0180243864{main}( )..\comments.php:0 ">

我需要将值传递给加载到内部的文件的任何帮助 div

我用这个方法在主页上获取值 http://localhost:8080/single.php?name=102

   $_GET['name']

您可以执行此操作以将查询字符串传递到文件。如果您的 URL 中有 $_GET['name'] 作为查询字符串,那么您可以这样做

 $("#zaladuj").load("comments.php?name=<?=isset($_GET['name'])?>");

例如:输出将是这样的

 $("#zaladuj").load("comments.phpname=102");