Вопрос по ajax!!!

12
[Удален]
#11

не вопрос!

Вот файло конвертации:

);

$input = strtolower(iconv('UTF-8','windows-1251', $_GET['input']));

$len = strlen($input);

$aResults = array();

if ($len)

{

for ($i=0;$i<count($aUsers);$i++)

{

if (strtolower(substr(iconv('UTF-8','windows-1251', $aUsers[$i]),0,$len)) == $input)

$aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars(iconv('UTF-8','windows-1251', $aUsers[$i])), "info"=>htmlspecialchars($aInfo[$i]) );

}

}

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified

header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1

header ("Pragma: no-cache"); // HTTP/1.0

if (isset($_REQUEST['json']))

{

header("Content-Type: application/json; charset=windows-1251");

echo "{\"results\": ["; $arr = array();

for ($i=0;$i<count($aResults);$i++)

{

$arr[] = "{\"id\": \"".$aResults[$i]['id']."\", \"value\": \"".$aResults[$i]['value']."\", \"info\": \"\"}";

}

echo implode(", ", $arr);

echo "]}";

}

else

{

header("Content-Type: text/xml");

echo "<?xml version=\"1.0\" encoding=\"windows-1251\" ?><results>";

for ($i=0;$i<count($aResults);$i++)

{

echo "<rs id=\"".$aResults[$i]['id']."\" info=\"".$aResults[$i]['info']."\">".$aResults[$i]['value']."</rs>";

}

echo "</results>";

}

?>

12

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий