Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> prototype i ResponseXML
Apo
post
Post #1





Grupa: Zarejestrowani
Postów: 426
Pomógł: 1
Dołączył: 2.10.2005

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


Witam

Mam pewien problem przy używaniu ResponseXML w prototype:

  1. function addComment() {
  2.  
  3. var myAjax = new Ajax.Request(
  4. url,
  5. {
  6. method: 'post',
  7. parameters: pars,
  8. onComplete: showResponse,
  9. onFailure: showError
  10. });
  11.  
  12. }
  13.  
  14. function showResponse(Request)
  15. {
  16. response = Request.responseXML; // tu występuje błąd
  17.  
  18. error = response.getAttribute('error');
  19. nick = response.getAttribute('nick');
  20. email = response.getAttribute('email');
  21. www = response.getAttribute('www');
  22. content = response.getAttribute('content');
  23.  
  24. if(error == 1)
  25. alert('Wystąpił błąd. Komentarz nie został dodany');
  26. else
  27. $('add_comment').innerHTML = content;
  28. }
  29.  
  30. function showError(Request)
  31. {
  32. alert('Wystąpił błąd!');
  33. }
  34.  
  35. var myGlobalHandlers = {
  36. onCreate: function(){
  37. Element.show('loader');
  38. },
  39.  
  40. onComplete: function() {
  41. if(Ajax.activeRequestCount == 0){
  42. Element.hide('loader');
  43. }
  44. }
  45. };
  46.  
  47. Ajax.Responders.register(myGlobalHandlers);


No i błąd występuje przy odbieraniu XML w : response = Request.responseXML;
Cały czas jest pokazany loader, że trwa zapisywanie komentarza (linie poniżej wogle nie są wykonywane), gdy zmienie
response = Request.responseXML; na
response = Request.responseText; i sprawdze co zwraca skrypt to otrzymuje xml wygenetowany przez XMLwriter:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <nick>Apo</nick><email>test@op.pl</email><www></www><content>Lorem ipsum Lorem ipsum Lorem ipsum</content><date>1169917331</date>


Pozdrawiam

Ten post edytował Apo 27.01.2007, 18:03:36
Go to the top of the page
+Quote Post

Posty w temacie


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 - 21:59