Commit 5c3c3df1 by kimth

Unbreak check_fd callback

parent 988136c4
...@@ -46,9 +46,11 @@ class @Problem ...@@ -46,9 +46,11 @@ class @Problem
$(placeholder).remove() $(placeholder).remove()
### ###
'check_fd' uses FormData to allow file submissions through an AJAX call. # 'check_fd' uses FormData to allow file submissions, in addition to simple,
NOTE: The dispatch 'problem_check' is being singled out for the use of FormData; # querystring-based answers, in the 'problem_check' dispatch.
can consolidate all dispatches to use FormData consistently #
# NOTE: The dispatch 'problem_check' is being singled out for the use of FormData;
# perhaps preferrable to consolidate all dispatches to use FormData consistently
### ###
check_fd: => check_fd: =>
Logger.log 'problem_check', @answers Logger.log 'problem_check', @answers
...@@ -66,20 +68,21 @@ class @Problem ...@@ -66,20 +68,21 @@ class @Problem
# Simple (non-file) answers, # Simple (non-file) answers,
# routed to Django 'request.POST' # routed to Django 'request.POST'
fd.append('answers', @answers) fd.append('_answers_querystring', @answers)
settings = settings =
type: "POST" type: "POST"
data: fd data: fd
processData: false processData: false
contentType: false contentType: false
success: (response) -> success: (response) =>
switch response.success switch response.success
when 'incorrect', 'correct' when 'incorrect', 'correct'
@render(response.contents) @render(response.contents)
@updateProgress response @updateProgress response
else else
alert(response.success) alert(response.success)
$.ajaxWithPrefix("#{@url}/problem_check", settings) $.ajaxWithPrefix("#{@url}/problem_check", settings)
check: => check: =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment