首页 > 语言 > JavaScript > 正文

jQuery 注意事项 与原因分析

2024-05-06 14:15:35
字体:
来源:转载
供稿:网友
1.在一个方法之外,一定要有个jQuery的全局方法启动,例如我要调用a方法做ajax提交,那么在页面的任一<script></script>标签内,加入jQuery(function(){}),而且这句话要放在全局,不能在方法块里面,否则a方法的jQuery.post()则不会起作用:
代码如下:
<head>
<script>
jQuery(function(){})
function a(url){
jQuery.post(url);
}
</script>
</head>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选