Php 参数未随Ajax请求发布
此Ajax请求可以工作,但参数似乎没有发布到getHint.php(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
$\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简单多了。