我有一个像这样的Jade / PUG html文件
if post_sucess == "true"
h1 TRUE
script.
$('#myModal').modal();
else if post_sucess == "false"
h1 FALSE
我希望myModal ID仅在if语句为true时运行。它应该是自动的,所以每当表单成功时,就会使用变量post_success呈现json页面,所以当这是真的时,我想打开#myModal
我该怎么做?
编辑:原来是语法错误,mod可以删除此帖子吗?
请尝试此代码,也许会对您有所帮助
// This code only works with function callbacks, like click or change
$("#myModal").modal()
// If you need to automatically show the modal, then passing some options into
//the modal, like
$("#myModal").modal('show')