Archive for the ‘JavaScript’ category

Last week I was working on one task, which required me to check data with AJAX when form is being submitted. Users clicks the button, request is made, data arrives, some hidden fields are modified, actual submit happens. The problem I ran into is, how to control form submission and ensure that it’s submitted only [...]

If you are using library such as jQuery, it supports AJAX responses in very different formats. For example, jQuery.get supports “xml”, “html”, “script”, “json”, “jsonp” and “text”. Which to choose?
Let’s say we have these variables, which we want to pass to JavaScript:

$array = array(
’status’ => ‘OK’,
‘message’ => ‘My status message’,
‘additional’ => array(1, 2, 3, [...]

Seadragon is technology, which allows you to create applications  capable of displaying unlimited size images in users (small) display. It works similar to Google Maps, where you move (zoom) closer and closer to the ground and see more and more details. When I first saw it (video available here) I couldn’t believe my yes – how [...]

In some situations, you need Checkbox and Radio elements functionality merged together. For example, imagine available discounts list where user can pick only one, but can pick none, because maybe he wants to use it later (lets say discounts are one-time). How would you do it in HTML?
Yesterday I was working with same problem and [...]

“JavaScript packing” is method for reducing JavaScript files size by removing all unnecessary data (obfuscating) and compressing it’s contents. Most popular is Dean Edward’s packer, which transforms JavaScripts into something like this:

eval(function(p,a,c,k,e,r){…

To start with, it’s very easy to have dynamically packed files (no one wants to pack them by hand, packed versions are only useful [...]