Click here to Skip to main content
15,867,308 members
Home / Discussions / Web Development
   

Web Development

 
GeneralCookies enable in Browser(urgent help) Pin
Ramkumar_S17-Mar-09 22:40
Ramkumar_S17-Mar-09 22:40 
GeneralRe: Cookies enable in Browser(urgent help) Pin
Ashfield18-Mar-09 2:27
Ashfield18-Mar-09 2:27 
RantRe: Cookies enable in Browser(urgent help) Pin
fly90418-Mar-09 9:56
fly90418-Mar-09 9:56 
QuestionEmail sending error in php Pin
Ahmad Hamid17-Mar-09 20:12
Ahmad Hamid17-Mar-09 20:12 
AnswerRe: Email sending error in php Pin
Ashfield18-Mar-09 2:29
Ashfield18-Mar-09 2:29 
AnswerRe: Email sending error in php Pin
Mohammad Dayyan18-Mar-09 3:50
Mohammad Dayyan18-Mar-09 3:50 
GeneralRe: Email sending error in php Pin
tech60318-Mar-09 15:50
tech60318-Mar-09 15:50 
QuestionPHP, Ajax function in IE Pin
Bryant May17-Mar-09 4:28
Bryant May17-Mar-09 4:28 
Ive written a function which works in Firefox but not in IE, in fact there are several things about this page that dont work in IE but this is the main one!!

I have a list view within a CMS that is displaying a list of pages within a web site. Part of the list is a status indicator (A graphic) which is either green, orange or red dependent on the current status of the page. Ive written an onclick Ajax function that alters the image and updates the DB stored status of the page. This is accomplished everytime the image is clicked - The icon is altered based on its current state, the function is called which creates an Ajax object, passes the current state and the id of the page to a PHP script which updates the mysql database. NOTHING IS RETURNED FROM THE PHP SCRIPT.

The code for this is as follows:

//PHP function call
showStatus($myRow['id'], $myRow['status'], $userID);


PHP function definition
function showStatus($id, $status, $editor)
{
if ($status == "1")
     print "";
if ($status == "5")
     print "";
if ($status == "9")
     print "";
}

function getStatus(id, editor)
{
	createObject();
	
	if (XMLHttpRequestObject)
	{
		var url = "/cms/functions/ajax/getStatus.php?id=" +id;
		
		XMLHttpRequestObject.open("GET", url, true);
		
		XMLHttpRequestObject.onreadystatechange = function()
		{
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
			{
				var result = XMLHttpRequestObject.responseText;	
				changeStatus(id, result, editor);			
			}
		}
		XMLHttpRequestObject.send(null);
	}	
}


//AJax function definition
function changeStatus(id, currentStatus, editor)
{
	createObject();
	
	if (XMLHttpRequestObject)
	{
		var icon = document.getElementById("statusIcon"+id);
		var url = "/cms/functions/ajax/statusUpdater.php?id=" +id+"&editor=" +editor+ "&curState=" +currentStatus;
		
		XMLHttpRequestObject.open("GET", url, true);
		
		XMLHttpRequestObject.onreadystatechange = function()
		{
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
			{
				
				var result = XMLHttpRequestObject.responseText;
			
				if (currentStatus == 1)
				{
					icon.src = "images/system/paused.gif";
				}
				if (currentStatus == 5)
				{
					icon.src = "images/system/stopped.gif";
				}
				if (currentStatus == 9)
				{
					icon.src = "images/system/active.gif";
				}
			}
		}
		XMLHttpRequestObject.send(null);
	}	
}


AND FINALLY

// The php mysql update
//INCLUDE THE SQL CONNECTION DATA
include "../../_sql/config.php";
include "../../_sql/connect.php";
 
$table = "structure";
$id = $_GET['id'];
$curState = $_GET['curState'];
$editor = $_GET['editor'];

if ($curState == "1")
	$nextState = "5";
	 
if ($curState == "5")
	$nextState = "9";
	 
if ($curState == "9")
	$nextState = "1";

$sql = "UPDATE $table SET status = '$nextState', dateEdited = CURRENT_TIMESTAMP, editedBy = '$editor' WHERE id ='$id'";
$doit = mysql_query($sql);


I have a feeling this is because nothing is being returned by the AJAX function because Firefox javascript console is telling me that no element is found however I dont know how to correct this.

Any ideas? Sorry about the length of this post



AnswerRe: PHP, Ajax function in IE Pin
fly90417-Mar-09 6:03
fly90417-Mar-09 6:03 
QuestionRegular expression help for javascript [modified] Pin
mynameissuraj17-Mar-09 1:32
mynameissuraj17-Mar-09 1:32 
QuestionIIS 5.1 SMTP virtual Server doesn't show in inetmgr Pin
D.Manivelan17-Mar-09 0:59
D.Manivelan17-Mar-09 0:59 
AnswerRe: IIS 5.1 SMTP virtual Server doesn't show in inetmgr Pin
Yusuf18-Mar-09 17:10
Yusuf18-Mar-09 17:10 
QuestionHow to come in google's first page in my website.. Pin
D.Manivelan16-Mar-09 20:39
D.Manivelan16-Mar-09 20:39 
AnswerRe: How to come in google's first page in my website.. Pin
SeMartens16-Mar-09 23:13
SeMartens16-Mar-09 23:13 
GeneralRe: How to come in google's first page in my website.. Pin
D.Manivelan16-Mar-09 23:26
D.Manivelan16-Mar-09 23:26 
GeneralRe: How to come in google's first page in my website.. Pin
SeMartens16-Mar-09 23:29
SeMartens16-Mar-09 23:29 
GeneralRe: How to come in google's first page in my website.. Pin
D.Manivelan16-Mar-09 23:45
D.Manivelan16-Mar-09 23:45 
QuestionUsing Flash to drag and drop files Pin
Jason Sachan16-Mar-09 12:00
Jason Sachan16-Mar-09 12:00 
QuestionJavascript - Dynamic arrays Pin
Bryant May16-Mar-09 7:34
Bryant May16-Mar-09 7:34 
AnswerRe: Javascript - Dynamic arrays Pin
fly90416-Mar-09 8:30
fly90416-Mar-09 8:30 
GeneralRe: Javascript - Dynamic arrays Pin
Bryant May17-Mar-09 4:10
Bryant May17-Mar-09 4:10 
GeneralRe: Javascript - Dynamic arrays [modified] Pin
fly90417-Mar-09 5:56
fly90417-Mar-09 5:56 
GeneralRe: Javascript - Dynamic arrays Pin
fly90417-Mar-09 9:37
fly90417-Mar-09 9:37 
Question"ASP" Email sending problem.. [modified] Pin
D.Manivelan16-Mar-09 4:27
D.Manivelan16-Mar-09 4:27 
AnswerRe: "ASP" Email sending problem.. Pin
tech60316-Mar-09 17:46
tech60316-Mar-09 17:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.