haku Posted June 5, 2008 Share Posted June 5, 2008 So I have an AJAX function. When I call the function, firebug shows me this: Now as you can see, its giving me the red x. BUT, if you look at the response, I am getting one, and it is the response I am expecting, which means that the file must exist, and is being run. The problem is that because of this error, which whatever it is I can't figure out, it is not processing my response when it gets back the response from the AJAX call. Here is the function I am using (sorry, kind of long) function setRegisterListener() { var targetButton = document.getElementById("submit_register_button") targetButton.onclick = function() { var proceed = true if(validateTextInput("username")) { var username = document.getElementById("username").value } else { proceed = false } if(validateEmailAddress("email")) { var email = document.getElementById("email").value } else { proceed = false } if(proceed == false) { return false } var fieldnames = [] var fieldvalues = [] $(".bottom_padding tr").each (function() { if($(this).children(":first").text() != "エリア" && $(this).children(":first").text() != "フルアクセス" && $(this).children(":nth-child(2)").children(":checked").val()) { fieldnames.push($(this).children(":first").text()) fieldvalues.push($(this).children(":nth-child(2)").children(":checked").val()) } else if($(this).children(":first").text() == "フルアクセス" && $(this).children(":nth-child(2)").children(":checked").val()) { fieldnames.push("full_access") fieldvalues.push("on") } }).end() var params = new String() params = "username=" + username + "&email=" + email for(var i = 0; i < fieldnames.length; i++) { params += "&" + fieldnames[i] + "=" + fieldvalues[i] } var URL = "ajax/add_new_user.ajax" var XMLHttpRequestObject = createXMLHttpRequest() if(XMLHttpRequestObject) { XMLHttpRequestObject.open("POST", URL, true); XMLHttpRequestObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); XMLHttpRequestObject.setRequestHeader("Content-length", params.length); XMLHttpRequestObject.setRequestHeader("Connection", "close"); XMLHttpRequestObject.onreadystatechange = function() { if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { var responseDiv = document.createElement("div") responseDiv.innerHTML = XMLHttpRequestObject.responseText var targetForm = document.getElementById("add_users") targetForm.insertBefore(responseDiv, targetForm.firstChild) } } XMLHttpRequestObject.send(params); } return false } } Any ideas? Quote Link to comment Share on other sites More sharing options...
haku Posted June 5, 2008 Author Share Posted June 5, 2008 Upon further research with firebug, I've also determined that the statusText is "Internal Server Error". Does anybody know what causes this error? Quote Link to comment Share on other sites More sharing options...
haku Posted June 5, 2008 Author Share Posted June 5, 2008 I figured it out. Within the serverside script being called with AJAX, there was a call to include a class that doesn't exist on my local server, only on my remote server. Since this was failing, it was causing errors, but the errors didn't show up on the response to the AJAX function, or at least not in the text portion. As a result, even though I was getting a response, I wasn't getting a status code 200, but rather one of 500, which meant that the response part of my ajax script wasn't executing. I'll just have to test remotely I guess. 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.