我正在一個項目中,我有像Facebook一樣的流發佈, 用戶也可以發佈任何網站的鏈接,我想實現它像Facebook一樣,即當用戶發佈鏈接時,它會顯示文本框下面的網站預覽,我不知道我怎樣才能做到這一點 我怎樣才能實現這個功能,我使用Ajax調用張貼在流網站預覽
$.ajax({
url: "My Controller ActionResult",
type: "POST",
data: JSON.stringify({ objResourceModel: objResource, objTagList: TagTypeList, sendEmail: $("#chkbxSendEmail")[0].checked, groupId: ResourceVariable.GroupId, isblog: isblog, isquest: isquest }),
dataType: "html",
contentType: "application/json; charset-utf-8",
beforeSend: function() {
$("#btnPost").attr("disabled", "disabled");
loading = setTimeout("$('#load').show()", 200);
},
complete: function() {
clearTimeout(loading);
$("#load").hide();
$("#btnPost").removeAttr("disabled");
},
success: function (Result) {
if (Result == "false") {
alert("Video must be of Youtube or vimeo");
}
else {
$('#divResourceDetails').html(Result);
ClearPostSectionData(); //function call
SetUpCommentSectionEvent(); //function call set up events
GetLatestAnnouncements();
$('#tagOutput').html("");
outputTagHtml = '';
TagTypeList = [];
//GetBrowseByInstructor(); //function call
//GetBrowseByTagType(); //function call
GetBrowseByResource(); //function call
GetBrowseByMonth(); //function call
}
},
error: function (msg) {
alert("Unable to save uploaded post details: " + msg.responseText);
}
});