index.html
<html>
<head>
<script src="//code.jquery.com/jquery-2.0.0.min.js"></script>
<script src="jquery.js"></script>
</head>
<body>
<div id="myDiv" name="myDiv" title="Example Div Element">
</div>
</body>
</html>
jquery.js
$.ajax
({
type: "GET",
url: "url",
dataType: 'image/png',
async: false,
beforeSend: function (xhr) {
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", "Bearer xxx");
},
complete: function (data) {
console.log("yello");
$('#myDiv').html('<img id="target">');
}
});
Simple enough question,
Why is this line not working? $('#myDiv').html('<img id="target">');
When I examine the source of the page nothing shows up, no image tag. I'm not quite understanding why as I am sure I am doing everything correctly.
Thanks!
$('#myDiv').html('Works !');and see if text appears or not.