An introduction to Jaxer - the worlds first ajax server

I don't think many people have heard of Aptana's Jaxer. I only found it by pure chance, but once I started to read about it I was hooked. What a great idea - an ajax server that gives you the ability to write an entire ajax application in one language, Javascript.

Jaxer takes the power of the Mozilla engine, that's the engine that powers Firefox, and embeds it into a web server. This means that you can do do full javascript processing, using all of the DOM APIs that you would normally use on a browser, as well as Javascript libraries like jQuery and Dojo, directly on the server.

Jaxer operates as an output filter which means you can use it in conjunction with any existing server side processing you might already have (php, python etc). But once you get started with Jaxer you might realize that you have no need for the other languages. Jaxer comes with full support for accessing databases, filesystems and network sockets and really is a one-stop ajax solution.

<div id="myDiv"></div>
<script runat"server">
  myDiv.innerHTML = "The page was generated at:" + new Date();
</script>

Jaxer provides a special runat attribute for the standard html <script> tag. This allows you to specify where the contained code should run - at the client, on the server, or both. Ajax functionality can simply be embedded into a single page.

<script runat"server-proxy">
  function getData() {
    Jaxer.DB.execute('SELECT * FROM NEWS');
  }
</script>
<a onClick="alert(getData());">get news</a>

I've been using Jaxer for several months now and am very impressed with what it's capable of - I would highly recommend it for anybody looking to develop an ajax application.  To get started with Jaxer I would recommend reading the following, all of which were a great help to me when I was first getting started:

jkp's picture

"I don't think many people have heard of Aptana's Jaxer. I only found it by pure chance, but once I started to read about it I was hooked. What a great idea - an ajax server that gives you the ability to write an entire ajax application in one language, Javascript."

nice, except for the Javascript bit.

hakman's picture

@ except for the JavaScript part? Have you been on the web lately? Heard the term Ajax? Ever use a Google gadget? What about Apple widgets on our desktop? Those use JavaScript too. This article by Mark Perkins is rather insightful on the ubiquity and continuously expanding use of JavaScript: How JavaScript is Quietly Taking Over the World http://blog.vgroup.com/post/how-javascript-is-quietly-taking-over-the-wo...

jkp's picture

@hackman It still *sucks* hard as a language though. I wouldn't personally want to use it for server-side code but each to his own.

hakman's picture
[...] Last week I wrote a short introductory article about Aptana's Jaxer. Today I want to follow on from there and introduce one on the new features that has been added in [...]
Jags's picture

Your post left me wondering that why isn't jaxer being discussed/used widely.
Developers should be going crazy over this !!
Are there any down-side to this ?

tom's picture

I think some people are reluctent to believe that JavaScript can actually offer a viable solution for server-side scripting because they believe that speed will be a major issue. However, if you look at the benchmarks on the Jaxer site, it stands up really well next to existing technologies such as PHP and Rails. Also, when JIT finally makes it into Firefox, that speed boost should be available to Jaxer running on the server too.

The few small bugs that I noticed in the beta phases have long since been ironed out.

Jags's picture

Guess you are right... Like it was only after google used ajax that everyone started taking Javascript as a serious client-side scripting.
Lets wait and see when that sort of thing happens with Jaxer!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.