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
Share on other sites

Try debugging.

 

Echo out some variables and what not.

 

responseText is the result, so either your request is wrong, or /process/postComment is messed up.

 

Try sending a request to /process/postComment with a form.

 

 

Link to comment
Share on other sites

  • 8 months later...
  • 2 weeks later...
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.