написал плагинацию для страници и решил сделать смену страничек через AJAX , а так как в ajax только начал разбиратся немного туплю=(
вот есть код
// XMLHttpRequest
var xmlHttp;
function createxmlHttp(){
try {
xmlHttp=new XMLHttpRequest();
}
catch(e){
//IE
try{
xmlHttp=new ActiveXObject("Msxm12.XMLHTTP");
}
catch(e){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
}
function connect(url){
//var param="page="+encodeURIComponent(url);
createxmlHttp();
xmlHttp.open("GET","test.php?id="+url,true);
xmlHttp.onreadystatechange=funcChange;
//xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send(null);
}
function timeOver(){
xmlHttp.abort();
alert("Время ожидания запроса истекло");
}
var timeOut=setInterval(timeOver,15000);
function funcChange(){
if(xmlHttp.readyState==4){
if( xmlHttp.status==200){
clearInterval(timeOut);
alert(xmlHttp.responseText);
}
else alert("ошибка запроса");
}
}
так вот чем проблема:
xmlHttp.responseText -возращает полный хтмл код страници.
как сделать чтоб возрашало только нужный мне текст?
как правильно написать ответ сервера в пхп коде?