i am wondering how i can render a List to template as an ajax callback arg.
i did this:
List<String> filteredTW = Twitt.filtertw(tagname);
return ok(filteredTW).as("text/plain");
but is says, i need to define ok(List) function on my own. is it true that Playframework doesnot offer this function?
i would be thanksful to any attemp to help..
EDIT: my ajax function is:
$(function() {
$('.filter').click(function() {
var tagname = $(this).text();
$('.post').remove();
$.ajax({
url: '/filter',
type: 'POST',
dataType: 'html',
context: this,
data: { tags: tagname },
}).success(function(response) {
alert(response);
});
});
})
thanks
You might want to try
return ok(play.libs.Json.toJson(filteredTW));In this case, you can treat
responseas a regular javascript array.