@martoy

Мне нужно вывести значение переменное из Python в javascript но эта переменная ничего не возвращает в return что делать?

Python код!
import eel
import random
import string
import webbrowser
import time
import requests
from termcolor import colored, cprint
import colorama
import os
import platform
import threading
from fake_useragent import UserAgent
from sys import argv, exit
from threading import Thread
from django.shortcuts import render

@eel.expose
def free(place):
	y = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(15))
	return y

eel.init("C:/Users/Martoy/Desktop/privat/web")

eel.start("reg.html",size=(600,550))

HTML
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Discord Nitro SignUp</title>

	<script src="eel.js"></script>
	<link rel="icon" type="image/png" href="/favicon.png">
	<link rel="stylesheet" href="main.css">
	<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap" rel="stylesheet">
</head>
<body>

	<h1>Испытай удачу! Получи код бесплатно!</h1>
	<input id="location" type="text" placeholder="Здесь будет код" required=""  value="">
	<button id="show2">Испытать удачу</button>
	<div id="info"></div>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script type="text/javascript">
    
    async function display_cod(){
    	let place = document.getElementById('free');
    	let res=eel.free(place);
    	document.getElementById('location').value=res;
    }
    jQuery('#show2').on('click', function(){
    	display_cod();
    });
  </script>

</body>
</html>
  • Вопрос задан
  • 223 просмотра
Ваш ответ на вопрос

Вопрос закрыт для ответов и комментариев

Потому что уже есть похожий вопрос.
Похожие вопросы