JSON Request Error 500

WarkilleR

New Member
I'm wanting to populate a select textbox with some dynamic data from another page. The page outputs a php array using json_encode. This is working fine for me on another page on the same site but for some reason the console in chrome and firebug say "500 (Internal Server Error)". If I browse to the page myself I can see the output fine, I've made sure the URL's correct as I opened the link that JSON failed to access.My request is:\[code\]var Type = $("#a option:selected").text();if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari dateChangeRequest=new XMLHttpRequest(); }else {// code for IE6, IE5 dateChangeRequest=new ActiveXObject("Microsoft.XMLHTTP"); }dateChangeRequest.onreadystatechange=function() { if (dateChangeRequest.readyState==4 && dateChangeRequest.status==200) { var returnList = dateChangeRequest.responseText; } }dateChangeRequest.open("GET","entList.php?ents="+Type,true);dateChangeRequest.send();\[/code\]Some example data from the dynamic page:\[code\][{"EntID":2,"Display":"Some Name - Alias"},{"EntID":3,"Display":"Some Other Name - Another Alias"}]\[/code\]I'm not sure if it means anything, but on the pages that are working firebug reports:\[code\]Connection Keep-AliveKeep-Alive timeout=15, max=90\[/code\]But on this page it reports:\[code\]Connection close\[/code\]even though the request header asks for keep-alive.Any help would be greatly appreciated.Actually, when I just put that example data on the page it's fetched fine. I'm generating the array of data from a database and then outputting with json_encode, which is working fine for another page. Here is an excerpt from the actual output of the page:\[code\][{"EntID":2,"Display":"Eddard Stark - Ned"},{"EntID":3,"Display":"Robb Stark - The Young Wolf"},{"EntID":5,"Display":"Catelyn Tully - Cat"},{"EntID":7,"Display":"Aegon I Targaryen - Aegon the Conqueror"},{"EntID":20,"Display":"Rhaenyra Targaryen - "},{"EntID":11,"Display":"Aenys I Targaryen - "},{"EntID":12,"Display":"Maegor I Targaryen - "},{"EntID":13,"Display":"Jaehaerys I Targaryen - "},{"EntID":14,"Display":"Viserys I Targaryen - "},{"EntID":15,"Display":"Aegon II Targaryen - "},{"EntID":16,"Display":"Rhaenys Targaryen - "},{"EntID":17,"Display":"Visenya Targaryen - "},{"EntID":74,"Display":"Jon Snow - Lord Snow"}]\[/code\]Some more info:It works fine when the data is static, i.e. I copy and paste the whole array onto the page as text and comment out all the data.I can actually see the response text in the chrome console, even though the server says Error 500.I have just tried echoing the structure of the array myself instead of json_encode and that doesn't work either.
 
Back
Top