Add type="button"
to the button.
<button name="data" type="button" onclick="getData()">Click</button>
The default value of type
for a button is submit
, which self posts the form in your case and makes it look like a refresh.
More Related Contents:
- How to send data to the server via Ajax?
- Making a quiz in HTML and Javascript [closed]
- Syntax Higlighter For Site [closed]
- How to find certain text in HTML
- javascript function doesn’t work when link is clicked
- Where should I put tags in HTML markup?
- What is offsetHeight, clientHeight, scrollHeight?
- Does Schema.org markup work if markup is dynamically built with JavaScript?
- Set active tab style with AngularJS
- Can someone explain this ‘double negative’ trick? [duplicate]
- HTML5 FileReader how to return result?
- How do image preloaders work?
- Prevent orientation change in iOS Safari
- Load HTML page dynamically into div with jQuery
- How to Clear/Remove JavaScript Event Handler?
- jQuery position DIV fixed at top on scroll
- JavaScript window.location does not set referer in the request header
- How to define the css :hover state in a jQuery selector?
- How to embed a PDF in HTML page?
- Change tag using javascript [duplicate]
- Create a string of variable length, filled with a repeated character
- The data-toggle attributes in Twitter Bootstrap
- Extracting text from a contentEditable div
- How to remove jQuery Mobile styling?
- How to make a button execute a php script?
- HTML5 input required, scroll to input with fixed navbar on submit
- Change onClick attribute with javascript
- focus on next tabindex of HTML element onEnter keypress by JQuery
- How can I use Perl to grab text from a web page that is dynamically generated with JavaScript?
- Find and replace nth occurrence of [bracketed] expression in string