How to write AJAX Application in bluebream first of all guys, I'll explain you the basics of an AJAX application in bluebream. What does ajax stand for ?! It stands for "Asynchronous Javascript and XML". In an Ajax application the requests are being done in the background. Therefore after loading a certain website, and accomplishing a certain task the whole thing is done in the background. The Javascript Application that had been delivered with the website on your computer does it all for you. Now enough. I'll explain now how the AJAX Page is written. Requirements: Dojo Library (the whole toolkit is for this little course not required): http://www.dojotoolkit.org/download/ Step 1: we create the view in HTML, and the JS Routine, where the XHR Request should be made of. This is also our main template in which will appear, after the site had been loaded, and save it under the filename: "index.pt" (all files of course are saved in the projectsfolder ? src/projectname/): Out beautifull site.....
Line 7: integrates the dojo library in the view. Line 9-20 : is a simple function, which makes our AJAX Request. Now in general explained: The DOJO XHR function has a paramater which defines the options, and it looks like this: var xarg = {url:'http://....',load: function(data){...routine....},error: function(error){...errorroutine...}} dojo.xhrGet(xarg); General: function(data) and function(error), the parameters are provided by the dojo functions. You can consider thinking of, a try (for success) and catch (error) routine in replacement. Line 12: the xhr parameter es described about function(data): Is the routine, when a successfully request had been done. In this routine, you decide what with the data should happen. Line 13-15: The request was successful and "function(data)" es being executed. In this sample we copy the content in our div element. function(error): Is the routine when the request couldn't be done. Example: the url doesn't exist, is not reachable. Line 15-17: There was no success, we decided to have a standard error message + the error message itself (which we could leave out). Line 19: performs the Ajax request! In both both cases, you can decide what will happen. Other functions are being executed, and you provide somehow the return. Professional developers, encapsulate the return with JSON, and decode it with Javascript once again, to perform certain decisions. Step 2: making the entries in the "configuration.zcml": Create a file ressource for our "dojo.js" file, which has in the view the following entry in the head section (Line 7) and 2 browser page entry. One for the class and one for the view. The class, with the respond has nothing to do with the template. Therefor, they registered 2x time in "configuration.zcml", because the template has a different name, and hasn't got anything todo with our class eother, both have different names respectively. Step 3: We create one template and one class for our simple application. The template is for our view, which we already displayed at Step 1. The class XHR.py looks like this: from zope.publisher.browser import BrowserView class XHR(BrowserView): def __call__(self): return "This is our XHR Response" Step 4 (last words): After creating our file ressource (hopefully you downloaded the dojo.js library: , the view and the class) and registering, you should have a small ajax application. These magical things could be done with "namedtemplates", classes with templates, and all things you love. Be continued, with more samples, creating complete different contents (choosen by the Get and post variables).