如何將HTML內容傳送到另一個HTML頁面
<p>我想在一個html頁面上填寫一個表單,然後將填寫好的表單發送到另一個html頁面上進行檢查並儲存。我只是不知道如何將數據從一個html發送到另一個html。我請求你的幫助。謝謝</p>
<pre class="brush:php;toolbar:false;">question.html
這是表單
{% extends 'dependencies.html' %}
{% block content %}
<div class="jumbotron container row">
<div class="col-md-6">
<h1>加問題</h1>
<div class="card card-body">
<form action="" method="POST" id="form">
{% csrf_token %}
{{form.as_p}}
<br>
<input type="submit" name="Submit">
</form>
</div>
</div>
</div>
{% endblock %}</pre>
<pre class="brush:php;toolbar:false;">approve_questions.html
我想在這裡獲取question.html的內容
目前為空</pre>
<pre class="brush:php;toolbar:false;">views.py
def questions(request):
form = addQuestionform()
if (request.method == 'POST'):
form = addQuestionform(request.POST)
if (form.is_valid()):
form.save(commit=False)
html = render_to_string("notification_email.html")
send_mail('The contact form subject', 'This is the message', 'noreply@codewithstein.com', ['example@gmail.com'],
html_message=html)
return redirect("login")
context = {'form': form}
return render(request, 'addQuestion.html', context)
def approve_questions(request):
return render(request, "approve_question.html")</pre>