Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.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请求发布_Php_Ajax - Fatal编程技术网

Php 参数未随Ajax请求发布

Php 参数未随Ajax请求发布,php,ajax,Php,Ajax,此Ajax请求可以工作,但参数似乎没有发布到getHint.php($\u POST['targetId']为空)。你知道我做错了什么吗 非常感谢 postAjaxRequestFunktion(minFunktion, 'getHint.php', 'targetId = ' + playId) function postAjaxRequestFunktion(minFunk,minUrl, mittArg) { var conte

此Ajax请求可以工作,但参数似乎没有发布到getHint.php(
$\u POST['targetId']
为空)。你知道我做错了什么吗

非常感谢

postAjaxRequestFunktion(minFunktion, 'getHint.php', 'targetId = ' + playId)

         function postAjaxRequestFunktion(minFunk,minUrl, mittArg)
         {
            var contenttype = 'application/x-www-form-urlencoded'
            var minRequest        = new skapaAjaxObjekt(minFunk)
            if (!minRequest) return false
            minRequest.open('POST', minUrl, true)
            minRequest.setRequestHeader('Content-type',   contenttype)
            minRequest.setRequestHeader('Content-length', mittArg.length)
            minRequest.setRequestHeader('Connection',     'close')
            minRequest.send(mittArg)
            return true
         }


         function skapaAjaxObjekt(minFunk)
         {
            try       { var   minRequest = new XMLHttpRequest()                   }
            catch(e1) { try { minRequest = new ActiveXObject("Msxml2.XMLHTTP")    }
            catch(e2) { try { minRequest = new ActiveXObject("Microsoft.XMLHTTP") }
            catch(e3) { minRequest = false }}}
            if (minRequest) minRequest.onreadystatechange = function()
            {
               if (this.readyState == 4 && this.status == 200 &&
                   this.responseText != null)
                     minFunk.call(this.responseText)
            }

            return minRequest
         }  

         function minFunktion()
         {
             hintArray = eval('(' + this + ')');    
         }
getHint.php:

$targetId = $_POST['targetId'];

我建议您在ajax请求更简单的地方使用js lib jQuery。。 也可以在php文件中使用 变量转储($\u POST);
将为您提供更多信息

您能否向我们展示您的HTML?我不确定您需要查看的HTML是什么?谢谢,jQuery简单多了。