Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> problem z IE..
emitra
post
Post #1





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 23.06.2002
Skąd: Opole

Ostrzeżenie: (0%)
-----


  1. var http_request = false;
  2.  
  3. function makeRequest( url, menuItem, id ) {
  4.  
  5. http_request = false;
  6.  
  7.  
  8. if (window.XMLHttpRequest) { // Mozilla, Safari,...
  9. alert ("Mozzila");
  10. http_request = new XMLHttpRequest();
  11. if (http_request.overrideMimeType) {
  12. http_request.overrideMimeType('text/xml');
  13. // Przeczytaj o tym wierszu poniżej
  14. }
  15. } else if (window.ActiveXObject) { // IE
  16. alert ("IE");
  17.  
  18. try {
  19. http_request = new ActiveXObject("Msxml2.XMLHTTP");
  20. } catch (e) {
  21. try {
  22. http_request = new ActiveXObject("Microsoft.XMLHTTP");
  23. } catch (e) {}
  24. }
  25. }
  26.  
  27.  
  28. if (!http_request) {
  29. alert('Poddaję się :( Nie mogę stworzyć instancji obiektu XMLHTTP');
  30. return false;
  31. }
  32.  
  33. var parameters = 'id=' + id;
  34. http_request.onreadystatechange = function() { alertContents(http_request); };
  35. http_request.open('POST', url, true);
  36.  
  37. http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  38. http_request.setRequestHeader("Content-length", parameters.length);
  39. http_request.send( parameters );
  40.  
  41. }
  42.  
  43. function alertContents(http_request) {
  44. if (http_request.readyState == 4) {
  45. if (http_request.status == 200) {
  46. alert (http_request.responseText);
  47. var xmldoc = http_request.responseXML;
  48. var elDocRoot = xmldoc.getElementsByTagName("root")[0];
  49. (...)
  50. (...)
  51. }


I teraz tak pod FF elDocRoot jest Obiektem i dalsze operacje super działają.
Pod IE elDocRoot zwraca NULL. XML jest przesylany poprawnie.

Pilna sprawa z gory dzieki za wszelkie rady
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




A czy strona, która zwraca ci tego XML, wysyła nagłówki że to co zwraca to XML? Bo jeśli nie, to IE nie jest taki inteligent by się tego sam domyślić (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
emitra
post
Post #3





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 23.06.2002
Skąd: Opole

Ostrzeżenie: (0%)
-----


  1.  
  2. <?xml version="1.0" encoding="ISO-8859-2"?>
  3. ..


Takie cos nie wystarczy zeby bylo na początku pliku (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif) ? Mogl bys powiedziec o jakie konkretnie nagłówki chodzi ?

Ten post edytował emitra 1.08.2007, 07:56:08
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




  1. <?php
  2. header("Content-type: text/xml; charset=iso-8859-2");
  3. ?>
Go to the top of the page
+Quote Post
emitra
post
Post #5





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 23.06.2002
Skąd: Opole

Ostrzeżenie: (0%)
-----


dziękuje, działa (IMG:http://forum.php.pl/style_emoticons/default/guitar.gif)

Pozdrawiam serdecznie
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.09.2025 - 22:44