當我運行我的網絡應用程序時,出現此錯誤。它說在這里發現錯誤:var rows = ({'CurrentLocation': 'Norwich'}, {'CurrentLocation': 'Sheringham'}, {'CurrentLocation': 'Cambridge'})這是我的代碼:def search(): cursor = mysql.connection.cursor(MySQLdb.cursors.DictCursor) cursor.execute("SELECT CurrentLocation FROM driver WHERE OnJourney=0") rows = cursor.fetchall() # data from database return render_template("Search.html", rows=rows)var rows = {{ rows }} var row; var locations = []; for (row in rows) { locations.push(row['CurrentLocation']); } var location; for (location in locations) { var origin = location; }有什么方法可以將該字典從 python 傳遞到 javascript 而不會出現此錯誤?感謝您的幫助
未捕獲的語法錯誤:意外的標記“&”
ibeautiful
2024-01-22 15:07:44