stoimen.com/blog

web developing

Archive for September, 2009

jQuery – stop an ajax call!

It’s a simple task with no simple question, although in jQuery, as I mentioned now, everything is very simple. Even this task.

In a short example we’ve a simple AJAX call with very large request.

xhr = $.ajax({
    url : 'www.example.com?some-large-call',
    success : function(responseText) {
        // some DOM manipulation
    }
});

But what if something changes the data we’d like to request with this call even before the response has come. For example I click on a category in the site but before all the data has come I’d prefer to see other category’s data. (more…)

setAttribute(‘class’) and IE

What happens on IE, our favorite browser, when you try to setup a class attribute on a DOM element? Actually this is not possible, because setAttribute(‘class’, ‘my-class’) is obviously working only on non-IE browsers.

On IE actually you should setup the class on an element with that structure:

element.setAttribute('className', 'my-class');

Tiny ArcGIS javascript library

I recently wrote a small, very very small, javascript library using ArcGIS. It might be helpful for someone however.

It’s really small and it can be extended easily.

The code and the samples can be seen on http://stoimen.com/arcgis