Llama explained – Javeline Teleport
After putting the llama project online, I’ve got quite a few questions about it from people who wanted to add the help feature to their project. Therefor I’ve decided to create a step by step tutorial on how to do this. Today I will talk about the use of Javeline Teleport, to get the message of your sever with AJAX.
Javeline Platform is a Ajax/RIA platform, comparable to Dojo, openLaszlo and those kind of frameworks. A framework of this size is really nice, but its simply overkill to do some simple AJAX, meaning getting some data of your server without reloading the page, on your HTML page. Luckily you can use Javeline’s communication layer, called Teleport, as standalone.
With teleport you can define an RPC function in the HTML page, call the function using javascript and paste result into the page.
Let’s take this information into practice and look at the llama application.
23 Feb 2007 Arnold Daniels




[...] Well, over time several other protocols were created. A group of people doing a lot of javascript based RPC thought it would be nicer to encode the messages using javascript itself. So they created JSON-RPC. With all the hype around web services the PHP developers felt that this was just bloat. Why not just use REST/POST to get the xml. If you want to call the method getUsers. Just call http://www.example.com/rpc.php?func=getUsers and you are done. No extra protocol needed. In particular for non-enterprise solutions this is a very easy way. [...]
Hi!
I did some playing with your code but I can’t seem to get teleport to pass variables around, or at least more than one. I poked and prodded around the ajax.org and the javelin developer site and couldn’t find the right syntax. I get no errors and the help fields work but my little game engine in ajax (Hammurabi, in honor of one of the very first computer games) doesn’t get the form fields value at all.
You can see the llama_msg.php file at
http://ffproject.net/xfer/llama/hamu_llama_msg.txt
BTW, I hope you don’t mind but I named Hammurabi’s prime minister Mr. Llama in your honor
Hi Renmiri,
Great to hear that you are working with TelePort. I am the developer of that library and Arnold asked me to answer your question. If you look at the following code you will see that it works (if I understood your question correctly that is):
var p1 = document.getElementById(”acresp”).value;
var p2 = document.getElementById(”bushelsd”).value;
var p3 = document.getElementById(”landb”).value;
var p4 = document.getElementById(”lands”).value;
llama_comm.getMessage(’newyear’,p1,p2,p3,p4);
When you type Ctrl-g you will get a debug screen in which you can try this code by pasting it in the ‘Javascript console’ section. If this wasn’t the nature of your problem don’t hesitate to ask me about it. If you wish, please join our mailinglist (http://lists.javeline.net/listinfo/internals) so that everybody can benefit from your questions and the answer to them.
Kind Regards,
Ruben Daniëls
Wooohoo!!!!
Got it to work finally! You should use my mods because it shows how to send mre than one value to the php, plus not only hardcoded msgid but form field values as well, allowing you to do form validation just using javeline teleport. Really cool!!!
http://ffproject.net/xfer/llama/index.html
(Try entering negative values!)
your suggestion worked, thanks!!! try it here
http://ffproject.net/xfer/llama/index.html
Download it here
http://ffproject.net/xfer/llama/hammurabi_ajax.zip
I just gotta say I loved Javeline teleport. This will make my life so much easier!!!