Указаны относительные пути:
var request = null;
function createRequest() {
try { request = new XMLHttpRequest(); }
catch (trymicrosoft) {
try { request = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (othermicrosoft) {
try { request = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (failed) { request = null; }
}
}
if (request == null) alert("Ошибка при создании объекта XMLHttpRequest!");
}
function makeinc() {
if(document.getElementById('q1_1').checked==true) id_num=0;
if(document.getElementById('q1_2').checked==true) id_num=1;
if(document.getElementById('q1_3').checked==true) id_num=2;
if(document.getElementById('q1_4').checked==true) id_num=3;
if(document.getElementById('q1_5').checked==true) id_num=4;
if(document.getElementById('q1_6').checked==true) id_num=5;
if(document.getElementById('q1_7').checked==true) id_num=6;
if(document.getElementById('q1_8').checked==true) id_num=7;
url = "js/count_test_info.php?id_num="+id_num;
createRequest();
request.open("GET", url, true);
request.send(null);
}
<?php
$filename="../result_file.txt";
$id=$_GET[id_num];
if(isset($id)){
$mas = file($filename);
$pieces = explode(": ", $mas[$id]);
$temp=trim($pieces[1])+1;
$mas[$id]=$pieces[0].": ".$temp;
$str = implode("\n", $mas);
$str = str_replace("\n\n","\n", $str);
//$str = iconv('WINDOWS-1251', 'UTF-8', $str);
$file_rec=@fopen($filename,"w");
if($file_rec) {
fputs($file_rec,$str);
fclose($file_rec);
$temp="wrote";
} else $temp="can't write";
}
?>