Pergunta

I have an index.php page which imports a "myjs.js" file which includes a document.ready() function. Inside the document.ready() function, I show the home tab by calling .hide(); on all the divs that represent the other tabs. I also have the code so that when i click on a tab, it hides the current div and shows the div that goes with the clicked tab.

one of the tabs that I have is the profile tab, where I have a POST form with a submit button. When I click the submit button, the page goes back to the home tab (exactly the same way as when I go to the page initially). Is there a way from preventing this from happening? The submit button corresponds to some php that i have at the top of my index.php page but I don't want to leave the profile tab when I click the button :(.

Thanks!

EDIT: actually, you can log on and see for yourselves, the code is live here: www.aaemexico.com/login.php

use credentials: username: asdf password: asdf

go to "perfil" tab and choose a new password (change it to asdf so that others can still access it) and click the button. preferably, i would like to not go back to the home tab after i click the button

Foi útil?

Solução

It sounds like the form is being submitted and the page is posting. You could probably override the submit function and prevent default events to prevent the document.ready from firing again.

Or, in your document.ready, check if the page is already loaded and don't do anything if it is.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top