Like below image link preview shown, it's an image of what I expect in same way as soon as user inserts a link in the textarea.
From link preview site, I am getting image
,url
,description
of site in console window, but I want to display inside a <div>
tag.
html:
<div class="show_lnk"></div>
<textarea class="form-control" placeholder="" id="url" name="user_status"></textarea>
jquery:
jQuery("textarea[name*='user_status']").blur(function () {
var target = jQuery(this).val();
$.ajax({
url: "https://api.linkpreview.net",
dataType: 'jsonp',
data: {q: target, key: '5a2e292e7d25bb63a2d3b4c63524cd10abe39420dc68c'},
success: function (response) {
var data=response;
$(".show_lnk").html('<img src="'+data.image+'" style="width:30px;height:30px;" ');
console.log(data.image);
}
});
});