Alistair Miles

Category: ajax

Writing a Custom Widget Using Dojo 0.3.1

I’ve just written a custom widget using Dojo 0.3.1, it’s called “MoreOrLessText”. It’s not the most amazing thing in the world but it illustrates the general process of writing a custom widget, which might be useful given that the current documentation for Dojo can be a little confusing. Here’s what I did …

Read the rest of this entry »

Advertisements

Internet Explorer AJAX Gotcha: “Object Required” Error

I came across this AJAX gotcha in IE yesterday … when I ran my brand new AJAX application in Internet Explorer 6.0 on my own computer, it worked fine, but when others ran it on their computers using the same version of IE, they got an “Object Required” javascript error.

I discovered (eventually) that, if the response to the XML HTTP request does not have Content-Type “text/xml”, then MSXML does not instantiate the responseXML member of the XMLHTTPRequest object, although it will instantiate the responseText member – see the MSXML2 API spec. Once I had fixed the server-side code to return the correct Content-Type, it worked. As an item of good-practice, you should probably include an “Accept: text/xml” header in the request, to be on the safe side.

Read the rest of this entry »

My First AJAX Application

I’ve just written my first AJAX (Asynchronous Java and XML) application, see the Claddier Discovery Service (try searching for ‘cloud’ or ‘atmosphere’). This application interrogates an OAI-PMH provider for metadata about papers and datasets harvested from CCLRC’s ePubs archive and the BADC’s data archive.

I’ve previously avoided Javascript like the plague, mainly because I knew there are browser compatibility issues, and because I didn’t know of any code editors that could provide the kind of developer support that is essential to developing production quality code (i.e. code completion, debugging, documentation tools etc.) I’ve also been used to strongly typed object-oriented languages like Java, so I didn’t know how to get the best out of the weakly-typed functional Javascript language, or how to write code that was easy to debug and test. However, I found a number of tools and resources that have made this work a lot easier.

Read the rest of this entry »