要实现AJAX请求向用户显示内容,但不显示在页面的源代码上,可以使用以下解决方案:
// 页面上的AJAX请求
$.ajax({
url: 'serverScript.php',
type: 'GET',
success: function(response) {
// 将服务器端脚本返回的内容显示在页面上
$('#content').html(response);
}
});
// 加密或混淆处理的内容
var encryptedContent = "1e10f8301c28...";
// 解密或解混淆并显示内容
var decryptedContent = decrypt(encryptedContent);
$('#content').html(decryptedContent);
需要注意的是,这种方法只能防止一般用户通过查看页面源代码获取内容,对于有一定技术能力的用户,仍然有可能通过其他手段获取到内容。