Witam,
mam mały problem. Zrobiłem kod który czyta ceny z innego pliku na ajaxie.
Wygląda to tak:
index.php
  1. <script language="javascript">
  2. function getHTTPObject() {
  3. var xhr = false;
  4. if (window.XMLHttpRequest) {
  5. xhr = new XMLHttpRequest();
  6. }
  7. else if (window.ActiveXObject) {
  8. try {
  9. xhr = new ActiveXObject("Msxml2.XMLHTTP");
  10. }
  11. catch(e) {
  12. try {
  13. xhr = new ActiveXObject("Microsoft.XMLHTTP");
  14. }
  15. catch(e) {
  16. xhr = false;
  17. }
  18. }
  19. }
  20. return xhr;
  21. }
  22.  
  23. function cena(){
  24. var request = new getHTTPObject();
  25.  
  26. if (request) {
  27. request.onreadystatechange = function() {
  28. if (request.readyState==4) {
  29. if (request.status==200) {
  30. document.getElementById("price").innerHTML=request.responseText;
  31. }}}};
  32. var cc = 1;
  33. var order = document.getElementById("order").value;
  34. var url = "cena.php";
  35. var params = "pro="+order;
  36.  
  37.  
  38. request.open('POST', url, true);
  39. request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  40. request.setRequestHeader("Content-length", params.length);
  41. request.setRequestHeader("Connection", "close");
  42. request.send(params);
  43. }
  44. </head>
  45. <h1>Step 1</h1>
  46. <form action="index.php?step=2" method="post">
  47. Your Order: <select name="order" id="order" class="inputbox" size="1" onchange="javascript:cena();" onselect="javascript:cena();">
  48. <option onselect="javascript:cena();" value="1">1 room free to air satellite tv</option>
  49. <option onselect="javascript:cena();" value="2">1 room free to air satellite tv and aerial tv(RTE1,2,TV3,TG4)</option>
  50. <option onselect="javascript:cena();" value="3">2 rooms free to air satellite tv</option>
  51. <option onselect="javascript:cena();" value="4">2 rooms free to air satellite tv and aerial tv(RTE1,2,TV3,TG4)</option>
  52. <option onselect="javascript:cena();" value="5">3 rooms free to air satellite tv</option>
  53. <option onselect="javascript:cena();" value="6">3 rooms free to air satellite tv and aerial tv(RTE1,2,TV3,TG4)</option>
  54. <option onselect="javascript:cena();" value="7">4 rooms free to air satellite tv</option>
  55. <option onselect="javascript:cena();" value="8">4 rooms free to air satellite tv and aerial tv(RTE1,2,TV3,TG4)</option>
  56. <b>Price:</b> <span id="price">.</span><br><input type="submit" value="Next"></form>


cena.php
  1. <?php
  2. $pro = $_POST['pro'];
  3. $cena['1'] = '1';
  4. $cena['2'] = '2';
  5. $cena['3'] = '3';
  6. $cena['4'] = '4';
  7. $cena['5'] = '5';
  8. $cena['6'] = '6';
  9. $cena['7'] = '7';
  10. $cena['8'] = '8';
  11. $cena['99'] = 'Error';
  12. if(empty($pro)){
  13.    $pro='99';
  14. }
  15.  
  16. echo $cena[$pro];
  17.  
  18. ?>


I jak wybiorę z select jakąś opcje to dalej widzę kropkę zamiast wartości jaka powinna być.

Testowałem na Google Chrome i IE.