Here are several pitfalls you'd like to know
- Second, how can you stop the execution flow, in another word, how can you stop the subsequent ajax call from your function "f"? Return false from "f" is not enough. You can link the return code from "f" to onclick like this onclick="return f()".
- Third, how can you catch the context such as event target and event when onclick is invoked? When onclick is called, two contextal variables are available: this and event. You can pass them to your function like this: onclick="return f(this, event);" or onclick="return f.call(this, event);";