Не работает JsHttpRequest.query() Что не так?
index.php
<script language="javascript" type="text/javascript" src="libs/lib/JsHttpRequest/JsHttpRequest.js"></script>
<script language="javascript">
function select_chat(st){
JsHttpRequest.query(
'backend.php',
{'str':st, 'num':10},
function(result, errors){
var list=document.getElementById('list');
list.length=0;
for(var i=0; i<result.list.length; i++){
list[0]=new Option(result.list[i]);
}
},
false
);
}
</script></head><body>
<table align="center" cellpadding="2px" cellspacing="1px" height="100%" width="99%">
<tbody bgcolor="#330000">
<tr><td width="5%"> </td><td bgcolor="#333333" width="90%">
<form><input type="text" id="nick" onKeyUp="select_chat(this.value)"/><br/>
<select id="list" size="8" style="width:100%" onclick="this.form.nick.value=this.value"></select></form>
</td><td width="5%">right_up</td></tr>
<tr height="5%"><td>left_down</td><td align="center">
</td><td width="33%">right_down</td></tr>
</tbody></table>
backend.php
require_once('libs/lib/JsHttpRequest/JsHttpRequest.php');
$JsHttpRequest=&new JsHttpRequest("windows-1251");
$str=$_REQUEST['str'];
$num=$_REQUEST['num'];
$textFile=file_get_contents('largetextfile.txt');
$words=preg_split('/[^\w+]/s', $textFile);
$words=array_unique($words);
$found=array();
foreach($words as $word){
if(strlen($str)&&0===strpos($word, $str)){$found[]=$word;}
if(count($found)>=$num)break;
}
global $_RESULT;
$_RESULT=array('str'=>$str, 'list'=>$found);