[英]OnLoad javascript AJAX Call
I need to create an onload event where an AJAX function is called and passed a value. 我需要创建一个onload事件,其中调用AJAX函数并传递一个值。 I can't put it on body because I have both my header and footer cut in sections via PHP. 我不能把它放在身上,因为我的页眉和页脚都是通过PHP切割的。 Apparently I can't put this on a div and 显然我不能把它放在div上
$(#midContainer).ready(function(){ Change('value1'); });
This doesnt seem to work and I am not sure why. 这似乎不起作用,我不知道为什么。 I got an 我有一个
"Uncaught SyntaxError: Unexpected token ILLEGAL" “未捕获的SyntaxError:意外的令牌ILLEGAL”
Replace: 更换:
$(#midContainer).ready(function(){
Change('value1');
});
with 同
$("#midContainer").ready(function(){
Change('value1');
});
You are missing quotes around your DIV's Id 您在DIV的ID周围缺少引号
What is wrong with document.ready
? document.ready
什么问题?
$(function(){
Change('value1');
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.