The jQuery Taconite Plugin allows you to easily make multiple DOM updates using the results of a single AJAX call. It processes an XML command document that contain instructions for updating the DOM.
On serverside, I had just created a simple class helper to build out the taconite xml format.
class jQuery(object):
def __init__(self): self._x=[]
def __getattr__(self,cmd):
def _d(*args,**kargs):
_p=lambda a: a.replace("&","&").replace('"',""").replace('>',">").replace('<',"<")
assert len(args)>0
if kargs: assert "content" in kargs
if "content" in kargs: # element commands
self._x.append(u"""<%s select="%s">%s</%s>""" % (cmd,_p(args[0]),kargs["content"],cmd))
else:
if cmd=="eval": #eval commands
self._x.append(u"<eval>\n<![CDATA[\n%s\n]]>\n</eval>" % args[0])
else: # non-element commands
a=[u'''%s="%s"'''%(k,_p(v)) for k,v in zip(["select","arg1","arg2","arg3","arg4"],args)]
self._x.append(u"""<%s %s/>""" % (cmd,u" ".join(a)))
return _d
def __repr__(self):
return u"<taconite>\n%s\n</taconite>" % "\n".join(self._x)
The html button test, will call the ajax url, which will answer by appending some content in the flow of div#content, by setting a border to div#content, and by evaluating the javascript code "alert()", on the clientside. (according to taconite commands like described here).