ajax - django JSON response does not attached to jQuery post sucess -


I use the Ajax Post method to send my form information to the DJ and after the results of a time consuming process Ajax comes back to the post. The problem is that when the reverse return result of the degeneration results, then it seems to be apeer on the web browser screen and it seems that the AJAX post is not bound to the method successfully. This is my Ajax Post method:

 < Code> $ ('#schoolSubmit') .on ('click', function (e) {e.preventDefault var form = $ ('# parameterform'); console.log ("waiting for ajax"); $ .ajax ({Type: "POST", url: $ (data, status) {console.log ('lablablab'); console.log (data)}})   Djang oview return result "lablablab" After my ajax po According to the method and the data should be printed in the console, but the result of retirements can be printed on the screen which can cause the demo view. 

Here is my demo view:

  def NNLearnSin (Request): Reference = RequestContext (Request) if request.method == 'POST': response_dict = // A time consuming process here JsonResponse (respons_ It seems that your form submit The button is actually submitting the form and click .  

e.preventDefault should be e.preventDefault () otherwise the submission by default is not "prevention".


Comments