I have an external end point
localhost:5000 which loads a simple html page with an image. A flask server is running there which serves html content.
I have another html file called index.html . In the index.html, I have a div called movie-data . I want to make a Ajax request localhost:5000 and append the html content in the div movie-data of index.html .
index.html :-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function init() {
$.ajax({
dataType: "html",
url: "http://localhost:5000",
success: function (data) {
console.log(data);
$("#movie-data").html($(data).append(data));
}
});
init();
</script>
<div id="movie-data"></div>
It is showing error,
Uncaught SyntaxError: Unexpected end of input
init();
$(data).append(data)does.... It makes no sense.