javascript - 在div中显示不同的内容

标签 javascript html modal-dialog load

我想在用户单击链接时更改 div 的内容。为此,我尝试使用以下代码:

function openModal() {
    el = document.getElementById("modal");
    el.style.visibility = "visible";
}    

function showContent(id) {
    openModal();
    $("#modal").load("modal/id.php");
    return false;
}    

但是,它不会将 "modal/id.php" 更改为 "modal/something.php",而是打开一个名为模态目录中的id.php。我怎样才能改变它?

最佳答案

不太明白你的问题是什么。也许这就是答案。

  1. PHP

        echo "This other text is inside a PHP script";
    
  2. HTML

enter image description here

关于javascript - 在div中显示不同的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24841549/

相关文章:

html - 为什么我的 div 位置正确?

javascript - 如何在 PixiJS 中更优雅地处理 WebGL CONTEXT_LOST_WEBGL 错误?

javascript - 如何开始为 React-Native 开发 npm 包?

javascript - 如何更新ReactJS中嵌套在对象内的数组的属性

javascript - 在 Datatables jQuery 完成之前不会显示模态

javascript - canvas drawImage 的 div

javascript - 您如何看待 Bootstrap 模式触发器的相应回调?

c# - WinForms 编程 - 模态和非模态表单问题

javascript - Bootstrap Modal 在不被查看或关闭的情况下立即消失

javascript - Vue 中的嵌套循环