<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <script language="javascript" type="text/javascript"> var url = "http://portal.pl/ajax/pobierzNazwe.php?id="; function handleHttpResponse() { if (http.readyState == 4) { var xmlDocument = http.responseXML; var wynik1 = xmlDocument.getElementsByTagName('nazwa').item(0).firstChild.data; document.getElementById('podzespol').value = wynik1; } } function aktualizujNazwe() { var numerSprzetu = document.getElementById("numer").value; http.open("GET", url + escape(numerSprzetu), true); http.onreadystatechange = handleHttpResponse; http.send(null); } function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); // Mamy obiekt HTTP </script> </head> <?php /** * * @version $Id$ * @copyright 2006 */ ?> <body> <form method="POST"> Nazwa podzespolu:<input type="text" id="podzespol" name="podzespol" /> </form> </body> </html>
<?php /** * * * @version $Id$ * @copyright 2006 */ $idPodzespolu = $_GET['id']; if ($idPodzespolu > 10) { $nazwa = "Karta graficzna ?"; // <-------- TU BYL BLAD! brak srednika } else { $nazwa = "A chuj go wie co to jest na sprzet"; } $wynik = '<?xml version="1.0" standalone="yes"?><dane><nazwa>'.$nazwa.'</nazwa></dane>'; ?>
poprostu nie dziala

o Boże, ale ze mnie debil, no nic juz "naprawione", mozna skasowac, chyba ze sie komus przyda (nowicjuszowi) najprostrze z mozliwych uzycie AJAXA