Jump to content

Big PROBLEM - Can Identify problem ... firebug isnt working


kipdlid

Recommended Posts

link -http://cyberphix.com/page1.php

Please help I have been trying this for 4 hours

 

I am trying to call the page call1.php with ajax to change the status of the disabled button

the code is ...

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Get Your Reward</title>

<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />

 

</head>

 

<body>

<script>

function ajaxfunk(email){

var ajaxRequest;  // The variable that makes Ajax possible!

 

try{

// Opera 8.0+, Firefox, Safari

ajaxRequest = new XMLHttpRequest();

} catch (e){

// Internet Explorer Browsers

try{

ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

} catch (e) {

try{

ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

} catch (e){

// Something went wrong

alert("Your browser broke!");

return false;

}

}

}

// Create a function that will receive data sent from the server

ajaxRequest.onreadystatechange = function(){

if(ajaxRequest.readyState == 4){

 

document.getElementById('header').innerHTML = ajaxRequest.responseText;

if (ajaxRequest.responseText == 13){

var frm=document.forms[0];

frm.Button1.disabled=false;

}

}

}

 

var queryString = "?email=" + email + ";

ajaxRequest.open("GET", "call1.php" + queryString, true);

ajaxRequest.send(null);

 

setTimeout("ajaxfunk('<?php echo $_GET['email'] ?>');", 5000);

}

 

</script>

<script type="text/javascript">

function clickclear(thisfield, defaulttext) {

if (thisfield.value == defaulttext) {

thisfield.value = "";

}

}

 

function clickrecall(thisfield, defaulttext) {

if (thisfield.value == "") {

thisfield.value = defaulttext;

}

}</script>

 

 

 

<div id="container">

<div id="menu">

 

<ul>

<li id="m01"><font color="white"><b>Step 1</b></font></li>

<li id="m02"><a>Step 2</a></li>

<li id="m03"><a>Step 3</a></li>

<li id="m04"><a>Step 4</a></li>

<li id="m05"><a>Step 5</a></li>

</ul>

 

</div>

<div id="header">

<div id="welcome">

 

<?php

if ($_GET['email']){

 

echo '<table><tr valign="top"><td></td><td width="400"><p align="center" style="margin-left:20px;">Complete Survey\'s to earn three survey points... This will get you to the next step... <Br><Br><button onclick="location.href=\'page2.php\';" disabled>Next Step</button><br><bR><Br><Br><bR><Br><Br><bR><Br><Br><br>Please Contact kipdlid@yahoo.com if errors occur!</p></td></tr></table>';

echo "<script>ajaxfunk(\'".$_GET['email']."\');</script>";

}

 

else {

 

echo "<h2>Enter your email</h2><br><form method='GET' action='page1.php'><table><tr><td><input value='email@example.com' type='text' name='email' onblur='clickrecall(this,\"email@example.com\")' onclick='clickclear(this, \"email@example.com\")'></td><td><input type='submit' class='submiter' value='' name='button1'></td></tr></table></form>";

 

}

 

 

 

 

?>

<br><br>

<a href="http://incentreward.directtrack.com/z/23909/CD13843/"><img src="http://incentreward.directtrack.com/42/13843/23909/" alt="" border="0"></a>

</div>

<div class="clear"></div>

</div>

<div id="middle"></div>

<div id="middle2"></div>

<div id="content">

<div id="left">

 

 

<a href="http://incentreward.directtrack.com/z/23908/CD13843/"><img src="http://incentreward.directtrack.com/42/13843/23908/" alt="" border="0"></a>

 

 

</div>

<div id="right">

 

<a href="http://nukemgames.com/" target="_blank"><img src="http://i145.photobucket.com/albums/r239/kipdlid/nukemgamesapp.png" border="0"></a>

 

</div>

<div class="clear"></div>

</div>

 

 

 

</div>

</body>

Link to comment
Share on other sites

The php page isnt displaying errors ... firebug doesn't look like its working to find any java script errors... The problem is I am not getting an ajax response

 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Get Your Reward</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />

</head>
   
<body>
<script>
function ajaxfunk(email){
var ajaxRequest;  // The variable that makes Ajax possible!

try{
	// Opera 8.0+, Firefox, Safari
	ajaxRequest = new XMLHttpRequest();
} catch (e){
	// Internet Explorer Browsers
	try{
		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try{
			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e){
			// Something went wrong
			alert("Your browser broke!");
			return false;
		}
	}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 4){

document.getElementById('header').innerHTML = ajaxRequest.responseText;
		if (ajaxRequest.responseText == 13){
var frm=document.forms[0];
frm.Button1.disabled=false;
}
	}
}

var queryString = "?email=" + email + ";
ajaxRequest.open("GET", "call1.php" + queryString, true);
ajaxRequest.send(null); 

setTimeout("ajaxfunk('<?php echo $_GET['email'] ?>');", 5000);
}

</script>
<script type="text/javascript">
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}</script>



<div id="container">
<div id="menu">

	<ul>			
		<li id="m01"><font color="white"><b>Step 1</b></font></li>
		<li id="m02"><a>Step 2</a></li>
		<li id="m03"><a>Step 3</a></li>
		<li id="m04"><a>Step 4</a></li>
		<li id="m05"><a>Step 5</a></li>
	</ul>

</div>
<div id="header">
	<div id="welcome">

<?php 
if ($_GET['email']){

echo '<table><tr valign="top"><td></td><td width="400"><p align="center" style="margin-left:20px;">Complete Survey\'s to earn three survey points... This will get you to the next step... <Br><Br><button onclick="location.href=\'page2.php\';" disabled>Next Step</button><br><bR><Br><Br><bR><Br><Br><bR><Br><Br><br>Please Contact kipdlid@yahoo.com if errors occur!</p></td></tr></table>';
echo "<script>ajaxfunk(\'".$_GET['email']."\');</script>";
}

else {

echo "<h2>Enter your email</h2><br><form method='GET' action='page1.php'><table><tr><td><input value='email@example.com' type='text' name='email' onblur='clickrecall(this,\"email@example.com\")' onclick='clickclear(this, \"email@example.com\")'></td><td><input type='submit' class='submiter' value='' name='button1'></td></tr></table></form>";

}




?>
<br><br>
<a href="http://incentreward.directtrack.com/z/23909/CD13843/"><img src="http://incentreward.directtrack.com/42/13843/23909/" alt="" border="0"></a>
	</div>
	<div class="clear"></div>
</div>
<div id="middle"></div>
<div id="middle2"></div>
<div id="content">
	<div id="left">


<a href="http://incentreward.directtrack.com/z/23908/CD13843/"><img src="http://incentreward.directtrack.com/42/13843/23908/" alt="" border="0"></a>		


</div>
	<div id="right">

<a href="http://nukemgames.com/" target="_blank"><img src="http://i145.photobucket.com/albums/r239/kipdlid/nukemgamesapp.png" border="0"></a>

	</div>
	<div class="clear"></div>
</div>



</div>
</body>

Link to comment
Share on other sites

The php page isnt displaying errors ... firebug doesn't look like its working to find any java script errors... The problem is I am not getting an ajax response

 

It does work well sort of. But why on earth are you using a timeout function to check it every few seconds?

If you have firebug check your "Net" tab and you will notice it does do the ajax call. It just doesn't send the value of the email

 

use the [ url ] [/ url ] tags  for links

http://cyberphix.com/page1.php

Link to comment
Share on other sites

   var queryString = "?email=" + email + ";

should be

   var queryString = "?email=" + email;


setTimeout("ajaxfunk('<?php echo $_GET['email'] ?>');", 5000);

should be

setTimeout(ajaxfunk('<?php echo $_GET['email'] ?>'), 5000);


echo "<script>ajaxfunk(\'".$_GET['email']."\');</script>";

should be

echo "<script>ajaxfunk('".$_GET['email']."')</script>";

 

I used webdeveloper toolbar all works now...

 

and FYI, your PHP was wrong

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.