How to read data From *.CSV file using javascript?

NOTE: I concocted this solution before I was reminded about all the “special cases” that can occur in a valid CSV file, like escaped quotes. I’m leaving my answer for those who want something quick and dirty, but I recommend Evan’s answer for accuracy. This code will work when your data.txt file is one long string of comma-separated entries, with … Read more

Simple throttle in JavaScript

I would use the underscore.js or lodash source code to find a well tested version of this function. Here is the slightly modified version of the underscore code to remove all references to underscore.js itself: Please note that this code can be simplified if you don’t need all the options that underscore support. Please find below a very simple … Read more

Play/pause HTML 5 video using JQuery

Your solution shows the issue here — play is not a jQuery function but a function of the DOM element. You therefore need to call it upon the DOM element. You give an example of how to do this with the native DOM functions. The jQuery equivalent — if you wanted to do this to … Read more

SON Post with Customized HTTPHeader Field

What you posted has a syntax error, but it makes no difference as you cannot pass HTTP headers via $.post(). Provided you’re on jQuery version >= 1.5, switch to $.ajax() and pass the headers (docs) option. (If you’re on an older version of jQuery, I will show you how to do it via the beforeSend … Read more

How to get client’s IP address using JavaScript?

I would use a web service that can return JSON (along with jQuery to make things simpler). Below are all the active free IP lookup services I could find and the information they return. If you know of others, then please add a comment and I’ll update this answer. Abstract  Run code snippetExpand snippet Limitations: 10,000 requests … Read more