状态:已中止但无效 [英] Status: Aborted and it don´t works

查看:71
本文介绍了状态:已中止但无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们有人知道这个问题吗?

我启动了一个ajax请求,但是Firebug告诉请求被中止了。如果现在右键单击并在新选项卡中打开请求,则请求有效。所以代码没有错。但为什么我不在主页上回答答案?



Hey guys someone knows this problem?
I start an ajax request, but Firebug tells the request is aborted. If you now take a right-click and open the request in a new tab, the request works. So the code has no mistake. But why I don´t recive the answer on the mainpage?

var xmlHttp = false;

       if (window.XMLHttpRequest) {
           xmlHttp = new XMLHttpRequest();
       } else if (window.ActiveXObject) {
           try {
               xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
           } catch (e) {
               try {
                   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (e) {}
           }
       }







<?php
header('Content-Type: text/html; charset=utf-8'); 
header('Cache-Control: must-revalidate, pre-check=0, no-store, no-cache, max-age=0, post-check=0'); // ist mal wieder wichtig wegen IE
$id = $_POST['id'];
echo $id;
?>







echo "<script>
	function loeschen ()
		{
		var loesche = document.getElementById(".$id.").id;
		xmlHttp.open(\"POST\",\"loesch.php\",true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send('id='+loesche);
		xmlHttp.onreadystatechange = Callback();
		}
	function Callback ()
		{
		switch (xmlHttp.readyState)
			{
			case 4:
				if (xmlHttp.status != 200)
					{
					alert('Fehler');
					}
				else
					{
					loesche.innerHTML = xmlHttp.responseText;
					}
				break;
			default:
				break;
			}
		}
</script>";



这里我有id:


Here i have the id:

echo "<a style='text-decoration:none; color:white' href='/Inhalte/Kategorien/".$kaufen[6]."' id='$id'  önclick='loeschen ()'>".$kaufen[0]."</a><br />";

推荐答案

id =
id =


_POST [' id'];
< span class =code-keyword> echo
_POST['id']; echo


id ;
?>







echo "<script>
	function loeschen ()
		{
		var loesche = document.getElementById(".


这篇关于状态:已中止但无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆