することはできません$( ".myClass" ).append('{% include "mytemplate.html" %}');
可能な方法の1つは次のとおりです。
<form action="#" method="post" id="testForm">
<input type="text" name="tester" value="">
<input type="submit" value="save" />
</form>
<div class="myClass"></div>
脚本
$("#testForm").on("submit", function(event){
$.post('url', $(this).serialize(),
function(data){
CreateRow(data);
}, "json");
event.preventDefault();
});
function CreateRow(dd){
$(".myClass").append(dd.mycontent);
}
URLのviews.py
import json
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def testpost(request):
str_html="""
<h1>....</h1>...your full htmlcode
"""
return HttpResponse(json.dumps({"mycontent": str_html}), mimetype="application/json")