[jQuery] Simple Ajax calls to server for data
First, I'm very new to JS/JQ. I've got a simple HTML list of items
that I want updated from the server whenever the user requests it (by
hitting a submit button). The results from the (Python/webpy) server
are held in a list result[]. Here is the html:
<div id="results">
"$result[0]"
<p class="alt">"$result[1]"
"$result[2]"
<p class="alt">"$result[3]"
"$result[4]"
</div>
This is what I have so far:
$.get("/ac", function(data) {
$("result", data).each(function(result_number) {
var result_text = $("result", data).get(result_number);
$("#results").append("".$(result_text).text()."
");
});
});
Which doesn't work! I'd like to return the results in JSON format for
performance. I know this is very simple to do and all help
appreciated.
Dinesh