The basic idea is to prevent double clicks. I'm using html <button>
to call a function when clicked, which makes an ajax call. Native <button>
behaviour is prevented with event.preventDefault()
, that means no form should be submitted. Also, i'm using TypeScript:
private form: JQuery;
...
private getTargetAndCallAjax(): void {
var target: string = this.form.find("form").data("target");
this.form.find("button[type='submit']").on("click", (event)=> {
event.preventDefault();
this.callAjax(target);
});
}
private callAjax(target: string): void {
...
}
As , i've implemented _.debounce
as:
private form: JQuery;
...
private getTargetAndCallAjax(): void {
var target: string = this.form.find("form").data("target");
this.form.find("button[type='submit']").on("click", (event) => {
event.preventDefault();
var ajaxCall = function () { this.callAjax(target) };
_.debounce(ajaxCall, 1000, true);
});
}
private callAjax(target: string): void {
...
}
The goal is to call this.ajaxCall(target)
every 1 second, if multiple <button>
clicks detected. Unfortunately, function this.ajaxCall(target)
gets never called. Any ideas?
In my current project I discovered a problem using websockets with socket.io and node.js on mobile devices. It seems that there is a problem for mobile deviced handling socket messages in an interval. ...
In my current project I discovered a problem using websockets with socket.io and node.js on mobile devices. It seems that there is a problem for mobile deviced handling socket messages in an interval. ...
With the following code, when shift clicking the label, why isn't the checkbox's click handler fired in FF? Both Chrome and IE11 fires it. <script> function show(event) { alert((...
With the following code, when shift clicking the label, why isn't the checkbox's click handler fired in FF? Both Chrome and IE11 fires it. <script> function show(event) { alert((...
So I'm trying to create a basic angular application that parses some CSV input, and fills a table with the parsed data. You can see a plunker of what I'm trying to achieve here - http://plnkr.co/...
So I'm trying to create a basic angular application that parses some CSV input, and fills a table with the parsed data. You can see a plunker of what I'm trying to achieve here - http://plnkr.co/...
Requirement : Trigger a jsp page refresh when some value in the server changes. Ajax is an option, but refreshing the JSP at a particular interval will increase the load on the server. Since i am ...
Requirement : Trigger a jsp page refresh when some value in the server changes. Ajax is an option, but refreshing the JSP at a particular interval will increase the load on the server. Since i am ...