Hello,

I am baffled by this and complete dumb as to the reason for this error:

{"readyState":4,"responseText":"","status":500,"statusText":"Internal Server Error"}

The code / function I get this error in is as shown here:

function get_gens_array($server, $iarray, &$tarray) {
  $tmpstr = "";

	foreach($iarray as $item) {  
    $httpurl = $server."/platform/tree/ancestry?person=$item&generations=8";
    $jsondata=http($httpurl, $_SESSION['token']);
  $jsonid=json_decode($jsondata,true);

		foreach($jsonid['persons'] as $p)
		{
			$mid = $p['id'];
		  if (!in_array($mid, $tarray)) { 
			  $tmpstr .= $mid.",";
			  array_push($tarray, $mid); 
				wf($mid); 
			}
		}
  }

	$tmpstr = substr($tmpstr,0,strlen($tmpstr)-1);
            $tmparray = explode(',',$tmpstr);
	get_gens_array($server, $tmparray, $tarray);
}

I appreciative of any insight on why this is happening and how I am causing it.

Thank you,

Kim H.

    Any number of reasons. Perhaps you're calling that function with the wrong number of params. Perhaps your [font=monospace]wf[/font] or [font=monospace]http[/font] functions have problems or are not defined. Perhaps your server is getting stuck in a loop because your function recursively calls itself unconditionally.

    You'd need to show us more code. More importantly,

    {"readyState":4,"responseText":"","status":500,"statusText":"Internal Server Error"}

    This is the error thrown in your javascript. All it tells us is that there was a server error - it doesn't even necessarily have anything to do with PHP. You need to show us the error thrown by PHP. If you do not have error reporting enabled, you need to do so.

    It wouldn't hurt to explain what you are trying to do, and describe what your other functions do / what values they return.

      You haven't even told us if the server you are calling is yours or someone else's. Since it's the server you are calling that is having the problem this is important for us to know.

      By rights a 500 response means the fault lies with the code running on the server you are calling. Maybe you are giving it bad input that it isn't able to handle properly - we've got no way to tell because we don't know what you're sending or what the server is expecting. Even though that would be partly your fault for giving it bad input, it would still imply a bug in the server because it should react to bad input with a response in the 400s.

      And of course you don't say anything about what your code does or is supposed to do if it does receive an error message from the server.

        This looks like you are using AJAX and your javascript created a js object after a request that received an error response from the server. I would recommend using something like the Firefox extension Firebug to inspect the actual contents of the server's response -- it may contain an error message. You could also try visiting the script directly in a browser and see what comes up. You might need to simulate and GET/POST parameters that are actually being used to cause the server error.

          Write a Reply...