I'm trying to append content to my div with ID "this_div" using AJAX.
HTML:
<a href='#' onclick="ajax('append?what=first',
['content'],'this_div')">click</a>
<div id='this_div'></div>
Controller:
def append():
if request.vars.what == "first":
something = "ABC"
else:
something = "DEF"
return "<script>jQuery('#this_div').append('"+something+"')</script>"
This loads the content of "something" to the div, but it doesn't preserve the previous content. Can anyone shed some light on why is it acting like that, please? I'm new to combination of Python/Web2Py/AJAX..
Thanks!