[英]jQuery AJAX: load HTML into DIV element after click
i would like to load (or be visible) an HTML/ASP.NET email form after the user clicked in a link/button. 用户单击链接/按钮后,我想加载(或显示)HTML / ASP.NET电子邮件表单。 I have used this code but it doesn't work:
我已经使用了此代码,但是它不起作用:
<script type="text/javascript">
$(document).ready(function () {
$("#imgMail").click(function (htm) {
$.get("mailform.html"),
$("#mailForm").append(htm)); //i have tryed also with .html() function.
});
});
</script>
where #imgMail is the ID of the link/button and the #mailForm is the ID of the DIV element into load the content. 其中#imgMail是链接/按钮的ID,而#mailForm是要加载内容的DIV元素的ID。
How can i resolve this problem? 我该如何解决这个问题? PS The elements are not into a form tag.
PS元素未放入表单标签中。
Thanks. 谢谢。
Use this.. 用这个..
<script type="text/javascript">
$(document).ready(function () {
$("#imgMail").click(function() {
$.get("mailform.html",function(data){
$("#mailForm").append(data);
});
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.