The Little Guy Posted June 30, 2008 Share Posted June 30, 2008 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); } Quote Link to comment Share on other sites More sharing options...
corbin Posted July 1, 2008 Share Posted July 1, 2008 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. Quote Link to comment Share on other sites More sharing options...
salexch Posted March 16, 2009 Share Posted March 16, 2009 Hi! I have this problem too, when I'm trying to alert(ajaxRequest.responseText); it works but when I'm trying to assign it to another variable it becomes 'undefined'.. anybody can resolve this for me? Quote Link to comment Share on other sites More sharing options...
dpacmittal Posted March 28, 2009 Share Posted March 28, 2009 try this: replace: if(ajaxRequest.readyState == 4){ with if(ajaxRequest.readyState == 4 && ajaxRequest.status==200){ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.