replies_js.html 777 B

1234567891011121314151617181920212223242526
  1. <script type=text/javascript>
  2. $(document).ready(function(){
  3. $('button#ajax').click(function() {
  4. $.ajax ({
  5. type : "POST",
  6. url : "{{ url_for('question.reply',qid=question.id) }}",
  7. data:JSON.stringify({
  8. content: $('#content').val(),
  9. quote: $('#quote').html()
  10. }),
  11. contentType: 'application/json;charset=UTF-8',
  12. success: function(result) {
  13. if (result.judge == true)
  14. {
  15. window.location.reload();
  16. }
  17. else
  18. {
  19. $("#showerror").show();
  20. $("#error").text(result.error);
  21. }
  22. }
  23. });
  24. });
  25. });
  26. </script>