Skip to content

Instantly share code, notes, and snippets.

@JshWright
Created May 28, 2010 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JshWright/417499 to your computer and use it in GitHub Desktop.
Save JshWright/417499 to your computer and use it in GitHub Desktop.
def show_messages(request):
messages = Message.objects.all()
return render_to_response('messages.html', {'messages': messages})
def ajaxsubmit(request):
new_msg = Message(msg = request.POST['msg'],
posted_by = request.POST['posted_by'])
new_msg.save()
jsonified_msg = serializers.serialize("json", [new_msg])
# Again, we're just going to assume this always works
return HttpResponse(jsonified_msg, mimetype='application/javascript')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment