Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jQuery/XMLWriter] Błąd przy odczytywaniu odpowiedzi.
starach
post 8.04.2009, 12:44:54
Post #1





Grupa: Zarejestrowani
Postów: 999
Pomógł: 30
Dołączył: 14.01.2007
Skąd: wiesz ?

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


Wysyłam metodą $.post() dane do serwera. Niestety przy odczytywaniu odpowiedzi jQuery pluje wyjątkiem.
Cytat
Błąd: uncaught exception: Node cannot be inserted at the specified point in the hierarchy (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)
Plik źródłowy: http://localhost/proj1/web/script/query/jquery-1.2.6.js
Wiersz: 238
Kod generujący XML wygląda tak:
  1. <?php
  2. class Ajax
  3. {
  4.    static public function sendError($msg)
  5.    {
  6.        header("Content-type: text/xml; charset=UTF-8");
  7.        $xml = new XMLWriter();
  8.        $xml->openURI('php://output');
  9.        $xml->startDocument('1.0', 'utf-8');
  10.        $xml->setIndent(true);
  11.        $xml->setIndentString("\t");
  12.        $xml->startElement('error');
  13.            $xml->startElement('message');
  14.            $xml->writeAttribute('value', $msg);
  15.            $xml->endElement();
  16.        $xml->endDocument();
  17.        $xml->flush();
  18.    }
  19. }
  20. ?>
I przy wywołaniu zwraca:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <error>
  3. <message value="Podana strona nie istnieje"/>
  4. </error>
Myślałem że błąd leży przy zamknięciu tagu <message> ale kiedy podmieniłem odpowiedź na:
  1. <error>
  2. <message>Podana strona nie istnieje</message>
  3. </error>
Problem pozostał ten sam. Nadal w konsoli Firefox'a widzę ten wyjątek.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
starach
post 8.04.2009, 14:20:53
Post #2





Grupa: Zarejestrowani
Postów: 999
Pomógł: 30
Dołączył: 14.01.2007
Skąd: wiesz ?

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


Kod
function DrawingsRequest() { }
DrawingsRequest.page = 1;
DrawingsRequest.Pane = new Pane();
DrawingsRequest.Pane.name = 'Drawings - LOG';
DrawingsRequest.Pane.content = '<ul>\n\
                            <li>Pobieram wyniki: <span class="request-time">0</span></li>\n\
                            <li class="debug"></li>\n\
                        </ul>'
DrawingsRequest.Counter = new Counter();
DrawingsRequest.Counter.jump = 0.1;
DrawingsRequest.Counter.meter = 0;
DrawingsRequest.Counter.duration = 100;
DrawingsRequest.Counter.eventRegister(function(){    DrawingsRequest.loading(); });
DrawingsRequest.send = function($trigger)
{
    $().ajaxError(function(event, request, $settings){ DrawingsRequest.handleError($settings); });
    
    DrawingsRequest.Pane.open();
    DrawingsRequest.Counter.start();
    $($trigger).attr('disabled', 'disabled').blur();
    $.post(Website.getDomain()+'drawings/', DrawingsRequest.preparate(),
        function($response)
        {
            DrawingsRequest.handleResponse($response);
        });
}
DrawingsRequest.handleError = function($settings)
{
    DrawingsRequest.Counter.stop();
    $('.debug', DrawingsRequest.Pane.jquery).html('Błąd połączenia z ' + $settings.url + '.');
}
DrawingsRequest.loading = function()
{
    var $time = new String(DrawingsRequest.Counter.meter);
    $('span.request-time', DrawingsRequest.Pane.jquery).html($time.substr(0, $time.indexOf('.') + 2));
}
DrawingsRequest.preparate = function()
{
    return { page: DrawingsRequest.page };
}
DrawingsRequest.handleResponse = function($response)
{
    DrawingsRequest.Counter.stop();
    $('#drawings').html($response);
}
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 15.08.2025 - 01:45