Answer the question
In order to leave comments, you need to log in
How to pass a string from Python to JS?
I have this python code:
@app.route('/mypage', methods=['GET', 'POST'])
def mypage():
myfile = 'somefile.txt'
return render_template('pages/mypage.html', myfile=myfile)
let someFile = document.getElementById("txt_id").textContent;
someFile = JSON.stringify(someMol).replace(/ /g,"");
console.log(someFile); #тут выводится: "somefile.txt"
document.addEventListener( "DOMContentLoaded", function(){
stage.loadFile('../../path_to_my_file/' + someFile ).then( function( o ) {
бла бла бла
});
}
);
let someFile = document.getElementById("txt_id").textContent;
someFile = JSON.stringify(someMol).replace(/ /g,"");
console.log(someFile); #тут выводится: "somefile.txt"
document.addEventListener( "DOMContentLoaded", function(){
stage.loadFile('../../path_to_my_file/somefile.txt').then( function( o ) {
бла бла бла
});
}
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question