Jump to content
php.lv forumi

Recommended Posts

Posted

function get_data(who){

if (typeof (xmlhttp.responseXML.getElementsByTagName("nick")[who]) == 'undefined') {
	return -1;
}

nick=xmlhttp.responseXML.getElementsByTagName("nick")[who].childNodes[0].nodeValue;

return nick;

}

 

Bet vienalga tev ar algoritmu viss tur nav kārtībā.

Posted

Rodas jautajums man ir poga >,kur uz onClick stav piem. (query), ka panakt, lai jv vaica query.php?id=1, un ka atgriezt datus jv, lai vinsh tos saprot?

Posted (edited)

pec query izpildes es ar php apstradaju datus un kada formata man tie janodot ? Vai man ir xml formata tie dati japadot?

Edited by tiy
Posted

Nav obligāti. Var padot ari vienkārši iekš GET, jeb, fails.php?var=bla&var2=ble.

 

xhr pieprasījums ir tādi pats kā jebkurš cits http pieprasījums - vari sūtīt datus gan caur get, gan caur post.

Posted

Meginaju 92 rinda ienest izmainas (xml.php) , bet tad vispar nestrada.

<?
 //xml.php
 //esam pieslegusgies datu bazei	
$a="";
foreach($usrid as $user){
	$a .="<user>";
	$a .="<id>".$user[0]."</id>";
	$a .="<nick>".$user[1]."</nick>";		
	$a .="</user>";	
}	
$list="<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
$list.="<users>";
$list.=$a;
$list.="</users>";	
//tagad list satur xml, ka vinu ir preizi japadaot atpakal?
?>

Posted

bubu gandriz sanaca tikai vel vajadzeja piemest

 

header ("Content-type: text/xml"); //shito rindu un viss ok

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";

echo "<users>";

 

foreach($usrid as $user){

echo "<user>";

echo "<id>".$user[0]."</id>";

echo "<nick>".$user[1]."</nick>";

echo "</user>";

}

echo "</users>";

 

jo man tieshi xml veida vajadzeja

×
×
  • Create New...