I post data to my flask back-end and on a successful post I want an action to occur, there are functions for success and error but on a successful post its going to the error function.
$.ajax({
url: '/some_route',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(data),
dataType: "json",
type: 'POST',
success: function(response){
alert('Success!')
},
error: function(error){
alert('Failed...')
}
});
What is the ajax call expecting back to confirm it has been successful?
Heres my Flask route
@app.route('/some_route', methods=['POST'])
def some_route():
if request.method == 'POST':
# Do something
return 'success', 200