0

I am using javascript in a jsp page to make some changes [adding a row in the table] to the current HTML page. The addition is happening successfully, but when i am about to exit from the function the page is getting reloaded.

How to avoid the page reloading and, show the page without any change in the scroll.

2
  • 2
    Unplug the network cable? Ok, seriously, what are you doing (precisely)? Are you using an onclick listener on a link to call a function that uses AJAX to update the document? You need to provide some inkling. Commented Sep 26, 2011 at 7:19
  • Do you have any code at least? Commented Sep 26, 2011 at 7:19

2 Answers 2

1

Add return false at the end of the function if it's an event handler.

I've seen people usually recommend event.preventDefault() but I've personally had it fail on some browsers for me. So not quite sure if that will work just as well.

Sign up to request clarification or add additional context in comments.

Comments

0

This is a bit vague, we don't know exactly what you are trying to do. However, I think it's better to use jQuery. Or AJAX. Learn jQuery and try to implement your code in jQuery, it's easy, efficient.

jQuery tutorial: http://www.w3schools.com/jquery/default.asp and AJAX tutorial: http://www.w3schools.com/ajax/default.asp

1 Comment

How can you seriously recommend a library when you have no idea what the issue is? And if you must recommend jQuery tutorials, please link to those on the jQuery site. w3schools is held in fairly low regard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.