Jump to content

ajaxRequest.responseText


The Little Guy

Recommended Posts

why do I get this message:

Service Temporarily Unavailable

 

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

 

From this line?

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

 

if I remove ajaxRequest.responseText; and replace it with 'hi'; it works.

 

Full functions:

function getVal(){
com = document.getElementById('message').value;
com = com.replace(/&/g,'%26');
var pType;
if(document.getElementById('profileID') != null){
	pro = document.getElementById('profileID').value;
	pType = 'profile';
}else if(document.getElementById('photoID') != null){
	pro = document.getElementById('photoID').value;
	pType = 'photo';
	userID = document.getElementById('userID').value;
}
val = 'com='+com+'&pro='+pro+'&pType='+pType;
if(document.getElementById('photoID') != null){
	if(userID.length > 0){
		val += '&userID='+userID;
	}
}
}
function pComment(id){
var contentType = "application/x-www-form-urlencoded; charset=UTF-8";
var ajaxRequest;
try{
	ajaxRequest = new XMLHttpRequest();
} catch (e){
	try{
		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try{
			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e){
			alert("Your Browser Doesn't support AJAX.");
			return false;
		}
	}
}
ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState < 4){
		document.getElementById('pC').style.disabled = 'true';
		document.getElementById('pComment').style.display = 'none';
		document.getElementById('newComment').innerHTML = '<img src="/images/loading.gif" alt="Posting..." />';
	}
	if(ajaxRequest.readyState == 4){
		document.getElementById('newComment').innerHTML = ajaxRequest.responseText;
		document.getElementById('message').value = '';
		//document.getElementById('commentsN').style.display = 'none';
	}
}
va = getVal();
ajaxRequest.open("POST", '/process/postComment', true);
ajaxRequest.setRequestHeader("Content-Type", contentType);
ajaxRequest.send(va);
}

Link to comment
https://forums.phpfreaks.com/topic/112640-ajaxrequestresponsetext/
Share on other sites

  • 8 months later...
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.