Jump to content

Firebug error (or is it?)


haku

Recommended Posts

So I have an AJAX function. When I call the function, firebug shows me this:

 

firebugio8.png

 

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.