Replicate this error in chrome, then go to network tab in dev tools, look at the request that gets 500 and check the response. You should be able to see the stack trace if debug is on. On 19 Jan, 2013 8:01 AM, "Dex" <dexter1...@gmail.com> wrote:
> Hi, I'm new to Django. I'm creating a game that has a 10x10 board and when > a cell is clicked upon, it will be marked with an "X". Marking the cells > works in jquery but I want to send data to server side to let it know that > the cell is marked. That way when I quit the game and come back later, it > will have an "X" on that cell. Currenly, my jquery code is this: > $('.target_cell').click(function(){ > if ($(this).text() != "X" && $(this).text() != "H"){ > $(this).text("X"); > var spot = $(this).attr('name'); //Cell index number like > in an array but in string format > $.ajax({ > type: "POST", > url: "/target_spot/{{game.id}}/" + spot + "/", > data: spot > }); > } > > And my view code is this: > @csrf_exempt > def target_spot(request, game_id, spot): > if request.is_ajax(): > game = fetch_game(request.user, game_id) > game.creator_target_board[int(spot)] = "X" > game.save() > > From my server log, i get the following message when I click on a cell: > "POST /target_spot/1/0/ HTTP/1.1" 500. Any ideas on how to solve this? > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/Aux0I4-eUNMJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.