【发布时间】:2018-05-20 15:11:53
【问题描述】:
ajax:
$.ajax({
type: "POST",
url: "calculator/panouri-simple/calcul-panouri-simple.php",
data: $("#formular_comanda").serialize(),
success: function(result)
{
document.getElementById("show_panels").innerHTML = result;
},
error: function(result)
{
console.log("Eroare:");
console.log(result);
}
});
HTML:
<div id="show_panels"></div>
当我在浏览器上查看“查看页面源代码”时,<div id="show_panels"> 和 </div> 之间没有 html 代码。
来自 ajax 的result 正在返回一些输入,我用另一个 ajax 调用这些输入,但在 html 页面源中,这些输入不存在。
它们在浏览器中可见,但 html 代码不存在于源代码中。我希望你明白我在这里的意思。看照片。
我在 php 文件中调用这些输入名称,我得到 undefined variabile ...。这是我的问题。从视觉上看,输入在那里,但没有 html 代码。
调试器:
【问题讨论】:
-
您是否设置了断点并确保
result不是undefined?这是什么? -
按@zero298 所说的做,如果返回一些东西,检查是否没有其他id 为
show_panels的元素 -
我在
succes ... result和result ="the html code I need"之后使用了调试器; -
我会用调试器上传一张照片。
-
请查看更新后的帖子并查看调试器照片。
标签: javascript jquery ajax html innerhtml