I would like to define a global ajax function that I will use to unlock models in case a window closes unexpectedly.
@main.route('_unlockmodels')
def unlockmodels():
.. unlock stuff ..
return None
and then the actual ajax
function unlockModel() {
$.ajax({
type: "get",
url: "main/_unlockmodels"
}).done(function(data) {
console.log('well see if your locks are gone', data, '<-- data?')
});
}
Problem is, wherever I call this function from (in another blueprint) I get the following error
GET http://127.0.0.1:5000/otherblueprint/page/main/_unlockmodels
How to specify where I am currently calling from (or other way to fix this)?
I call the function from within my page's javascript
like
window.onbeforeunload = unlockModel;