Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用ajax发送xhr.send((s.hasContent&;s.data)| | null)时出错_Php_Ajax_Html_Jquery - Fatal编程技术网

Php 使用ajax发送xhr.send((s.hasContent&;s.data)| | null)时出错

Php 使用ajax发送xhr.send((s.hasContent&;s.data)| | null)时出错,php,ajax,html,jquery,Php,Ajax,Html,Jquery,我有两个文件,一个是html5,它有一个脚本,从输入加载数据,并使用ajax将其发送到另一个php文件,并在html5页面的div中显示php响应。我使用的是eclipse浏览器,但当我在chrome控制台中验证我的页面时,我发现这一行有一个问题: xhr.send( ( s.hasContent && s.data ) || null ); 这是我的html文件: <!DOCTYPE html> <head> <script src="htt

我有两个文件,一个是html5,它有一个脚本,从输入加载数据,并使用ajax将其发送到另一个php文件,并在html5页面的div中显示php响应。我使用的是eclipse浏览器,但当我在chrome控制台中验证我的页面时,我发现这一行有一个问题:

xhr.send( ( s.hasContent && s.data ) || null );
这是我的html文件:

<!DOCTYPE html>
<head>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="jquery.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
(function ($) {
    // used to keep a reference to the ajax request object
    var searchQuery = false;

    var showUser = function (str) {
        if (searchQuery != false) // if there is a pending request, cancel it
            searchQuery.abort();

        var searchTerm = $('#matr').val();
       //  if (str.trim().length < 1)
       if (searchTerm.trim().length < 1 ){
           $("#txtHint").html('');
            return;
        } 

        // clean up the old accordion
        if ($("#accordion").length > 0)
            $("#accordion").accordion('destroy');
        $("#txtHint").html('searching...');

        searchQuery = $.ajax({
            'url':'http://IP/filename/accueil.php?q='+searchTerm,
            'success':function (response) {
                searchQuery = false;
                $('#txtHint').html(response);
                $('#accordion').accordion();
            },
            'error': function () {
                searchQuery = false;
                $('#txtHint').html('Sorry, there was an error');
            }
        });
    };

    // add the change event to the text field, once the page loads
    $(document).ready(function () {
        $('#matr').change(showUser);
    });
})(jQuery);
</script>    
</head>
<body>     
 <center> 
 <form name="data" >
   <label>Enter the data :</label>
<input type="text"  id="matr"  >
</form></center>
<br>
<center>   
<div id="txtHint"><b>Clique here to show data</b></div></center>
  </div>
</body>
</html>
收集值并将其显示在div中

但是当我执行时,在jquery.js文件中会出现错误: xhr.send((s.hasContent&s.data)| | null)

如果你有什么想法,请告诉我

$q =$_GET['q'];