I figured out that loadJSONDoc() can accept a string from turbogears
and will display it properly in the div, but when I try having
turbogears return a filled in template, I get no results in the div.
Here are some snippets of code:
javascript that runs when someone clicks an item:
function requestAvailableParameters(option) {
str = getForm()
var s = "availableParameters"+str
var d = loadJSONDoc(s);
d.addCallback(showAvailableParameters);
}
function showAvailableParameters(result) {
currentPageList = result
var v = document.getElementById('availableParameters')
v.innerHTML = currentPageList
}
The name of the page is "availableParameters", getForm simply
determines which checkboxes are active on the page.
Here is my turbogears code:
@expose(template="turbolink.templates.extractor.availableParameters")
def availableParameters(self, **kw):
return dict()
and availableParameters.kid:
<html xmlns="http://www.w3.org/1999/xhtml">
Hi mom!
</html>
Any info would be usefull.
-percious
function showAvailableParameters(result) {
var v = document.getElementById('availableParameters')
v.innerHTML = result.responseText
}
Personally, I feel this is a MUCH easier way of manipulating AJAX
objects because you are using templates and the normal tubogears stuff
instead of messing around with JSON. Don't know how y'all feel about
it, but I am interested in your response.
-chris
I suggest reading this:
Hijax http://domscripting.com/blog/display/41
It's quite a good strategy for using ajax, etc.
-chris