Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Ajax
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) {}
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;\"POST\",\"loesch.php\",true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange = Callback();
	function Callback ()
		switch (xmlHttp.readyState)
			case 4:
				if (xmlHttp.status != 200)
					loesche.innerHTML = xmlHttp.responseText;
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 />";
Posted 21-Jan-13 10:20am
Edited 21-Jan-13 10:37am
Sergey Alexandrovich Kryukov at 21-Jan-13 15:31pm
You present no evidence that "code has no mistake"... :-)
Chi Ller at 21-Jan-13 15:33pm
But if the code would have some mistakes, it wouldn´t work by open the request in a new tab, right?
richcb at 21-Jan-13 15:36pm
Just because it compiles, does not mean the logic is correct.
Chi Ller at 21-Jan-13 15:38pm
so now you have the code. You can convince youself about mistakes
Sergey Alexandrovich Kryukov at 21-Jan-13 15:56pm
I cannot see why. This is a pretty usual behavior of wrong code: working in some cases, not in others.
Also, you fail to follow simple logic. What do you call "right" code? If it does not achieve what you wanted to achieve, it is already wrong, in this sense...
Chi Ller at 21-Jan-13 16:10pm
sure in this sense the code is wrong. But when I said there´s no mistake I mean mistakes like a forgotten semikolon, a wrong command,...
Sergey Alexandrovich Kryukov at 21-Jan-13 16:22pm
What you are mentioning is next to nothing. We never even discuss the code which does not compile.
OK, you tend to claim things without any arguments at all, so let me break this discussion. You cannot get help by definition, as you simply resist it. To me, case closed. But someone else might find some problem in your code, so -- good luck.
Sergey Alexandrovich Kryukov at 21-Jan-13 16:28pm
Oh no, sorry. That's not all. There is one totally unrelated issue.
And this is a big warning for you. I had to remove all your "answers" in this forum, and, by the way, for your own good. Such things often cause reports for abuse. A number of heavier abusers already lost their memberships, but I want just to warn you for now.
You "answered" your own questions and then even formally accepted them. Why?! This is cheating. Don't do it; no one will welcome it, if such behavior will be brought to the discussion of the community.
Consider you are warned.
Chi Ller at 21-Jan-13 16:39pm
Wtf? That´s not cheating. I need help and nowbody could help me. So if I find the solution on my own, I gonna answer my own question and accept the answer. If now somebody else has the same problem he can easy find a working solution.
Sergey Alexandrovich Kryukov at 21-Jan-13 16:46pm
I understand that you did not want to do something bad. You can do the following: if you have some interesting solution, you can write a small Tips & Tricks article (or a big one, if appropriate), and post it; you can reference your original question if you want. It won't cause abuse reports. What I say about abuse reports is just the fact...
Zoltán Zörgő at 21-Jan-13 15:46pm
Do you have something against jquery? If not, try it. It will care about lots of hings, you would have missed.
Chi Ller at 21-Jan-13 15:51pm
I "promised" myself firstly finish all actions by myself before using jquery :D
But I think the code is alright.
Zoltán Zörgő at 21-Jan-13 15:57pm
I suggest you try it with jquery. It's a few lines of code only. If you get the same result, than your assumption will be most likely proven. If not, than you missed something. You can also use fiddler to see what's behind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 645
1 Maciej Los 225
2 Abhinav S 171
3 Richard Deeming 160
4 Suvendu Shekhar Giri 159
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 9,095
2 Peter Leow 5,044
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,581

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100