The example I was testing is very simple: just one button, and when button is clicked then a function will be called. However, I'm getting:
error ReferenceError: AddNewData is not defined {"error": "Please use POST request"}
Here is the jsfiddle link: http://jsfiddle.net/tridip/62Ls6x9n/158/
<button onClick="javascript:AddNewData();return false;">Add New Data</button>
function AddNewData()
{
alert("test");
}
Can someone tell me what is wrong there?
It's because by default jsfiddle uses onLoad
JS definition for your code.
That's it - it's wrapped in an anonymous function so all symbols (variables, functions, etc) are scoped within.
Change it to No wrap - in <head>
http://jsfiddle.net/62Ls6x9n/160/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With