[英]why is my jquery function not loading on page start?
I have a jquery function. 我有一个jQuery函数。 I also have a variable, $id_number
. 我还有一个变量$id_number
。
If the value in variable exists: 如果变量中的值存在:
I want the jquery function to load. 我想加载jQuery函数。 This is a modal that should pop up on page start. 这是一个应该在页面开始时弹出的模式。
<? if(isset($id_number)) { ?> jQuery(document).ready(function( <? } else { ?> jQuery(function($){ <? } ?> // code });
why is my function not loading on page start? 为什么我的函数无法在页面启动时加载? What am i doing wrong? 我究竟做错了什么?
This should work 这应该工作
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<? if(isset($id_number))
{ ?><script>
alert('dummy');
</script>
<? }
else
{ ?>
<script>
alert('data');
</script>
<? } ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.