Search

Tutorials, tips&tricks, snippets..

#KISS: KEEP IT SIMPLE, STUPID!

Category

HTML

Disable onClick after first click to avoid double (or more) clicks

In my app (but this is valid also for web app), I have a problem: if user clicks twice (or more), twice requests (or more) are sent to the API server. Here a snippet to avoid this behavior with useless requests.

var pending = false;

function Foo(param)
{
    // test to see if something else set the state to pending.
    // if so... return, we don't want this to happen.
    if(pending) 
        return;

    pending = true; // raise the flag!

    /* ... later ... */
    // in the success method of your AJAX call add:
    pending = false;
}
Advertisements

How to create expandable FAQ page in HTML?

I needed to create a simple FAQ page for my Phonegapp app. I found a lot of sample, but all of them were too complicated, I was searching for a simple one.

After a while, I found some useful examples and I put them together to create my FAQ page with HTML, CSS and Javascript.

Continue reading “How to create expandable FAQ page in HTML?”

Round button in HTML5 with CSS3

Quick snippet below: how to create round button in HTML5 with CSS3.
Continue reading “Round button in HTML5 with CSS3”

HTTP POST Request with C#

In the following samples, you can find out how to send a HTTP POST request with C#. I work a lot with JSON, so here I’ll show how to send a JSON string. Here we go!

Continue reading “HTTP POST Request with C#”

HTTP GET Request with C#

In the following samples, you can find out how to send a HTTP GET request, using C# with authentication and without it. Here we go!

Continue reading “HTTP GET Request with C#”

Distance in metres between two GPS points

I’m using Javascript for a cross platform app (using Devextreme as developing tool, it is based on PhoneGap) and I need to read the GPS position and compare it with another fixed point. Here how to do it.

Continue reading “Distance in metres between two GPS points”

Use jQuery from Google Chrome console

Sometimes is useful exploit the power of jQuery from the browser console. If you are in page/site/web application including jQuery itself, no problem: just open the console and do your stuff. And otherwise?
Continue reading “Use jQuery from Google Chrome console”

Powered by WordPress.com.

Up ↑