$(document).ready(function(){
$('#id_button').click(function(){
if ($('#id_text').val()==='')
alert('Enter Your Id to proceed');
else {
$('body').load('attendee.html');
alert(UID_USER);
}
});
});
此处变量UID_USER
是attendee.html
的变量。如何使用id_text?
答案 0 :(得分:0)
如何使用id_text的值设置此页面的值?
您以某种方式将值传递给attendee.html
,可能在查询字符串上:
$(document).ready(function(){
$('#id_button').click(function(){
var id = $('#id_text').val();
if (id ==='')
alert('Enter Your Id to proceed');
else {
$('body').load('attendee.html?' + encodeURIComponent(id));
}
});
});
attendee.html
页面上的代码会在页面加载时查看location.search
查询字符串信息。并将其分配给UID_TEXT
:
// Get the id from the query string, skipping the ? character
UID_TEXT = location.search ? decodeURIComponent(location.search.substring(1)) : "";
答案 1 :(得分:0)
我认为在attendee.html中的某个地方存在类似:
var UID_USER = "Some Value";
在这种情况下,您只能在加载页面后才能访问此值;
$('body').load('attendee.html', function(){
alert(UID_USER);
});
结帐load功能