El HTML que se muestra en "Ver código fuente" es diferente al HTML que se muestra en Firebug

I'm experiencing some very strange behavior after submitting a form.

I have a php page (mobile.php) that generates a series of forms (one at a time on separate requests). On submit the same php page (mobile.php) is called and it returns the next form.

Here's the really bizarre thing ... when I view source on the second page it shows the html from the first page, even though the browser is correctly displaying the second page. I then checked firebug and saw that it was also correctly showing the html for the second page.

One consequence of this is that my javascript form validation does not work on the second page. I figure this might well have something to do with this weird HTML discrepancy.

¿Alguna idea?

preguntado el 09 de marzo de 12 a las 13:03

Posting any sort of code, screenshots or indeed anything at all will drastically increase our possibilities of helping you out. -

Are you using normal post/gets with the form or are they Ajax requests? -

1 Respuestas

View > Source shows the source of the current document

Firebug shows a live view of the DOM, which starts out with the document source, is modified by error recovery and then may be further modified by JavaScript.

Presumably the second "page" is being loaded via Ajax or otherwise created via DOM manipulation.

respondido 09 mar '12, 13:03

I'll add that Firebug shows the DOM tree in an indented, organized and beautified way that may not match the original markup exactly. - Michael Berkowski

Firebug is one of the many debugging tools that Javascript and other programmers use to view the live changes to the DOM to make sure their scripts are working as intended. Without such a tool you'd have to imagine all the changes without seeing them. The view source and firebug are totally different worlds. - user17753

I think the problem might be because I'm using JQuery Mobile which has a designated "page div" which presumably get refreshes on the submit. My question now is how to ensure that my validation works on the modified code. I'm using the following Jquery code for validation ... - user1259388

How do I get this to recognize the modified div? - user1259388

You've got two sets of code (the reloading and the validation) that you haven't shared with us. I can't tell you why they aren't interacting the way you want because I can't see them. - Quentin

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.