Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2021
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. ajax:
  2. function ajaxFunction(point,route_code){
  3. console.log(route_code)
  4. $.ajax({
  5. type : 'POST',
  6. method: 'POST',
  7. url : "/new_coords",
  8. contentType: 'application/json',
  9. headers: {'Accept':'application/json'},
  10. data : {code: route_code},
  11. success: function(data){
  12. //new_coordinates(point,)
  13. console.log(data)
  14. }
  15. });
  16. }
  17.  
  18. Flask router:
  19. @app.route("/new_coords",methods=['POST'])
  20. def new_coords():
  21. print(request.data) //менял на request.json, ошибка 400
  22. //выводит b'code=1232456'
  23. return 1
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement