我使用这个脚本:
<script type="text/javascript">
$(document).ready(function(){ /* PREPARE THE SCRIPT */
$("#weeknummer").change(function(){ /* WHEN YOU CHANGE AND SELECT FROM THE SELECT FIELD */
var weeknummer = $(this).val(); /* GET THE VALUE OF THE SELECTED DATA */
var dataString = "weeknummer="+weeknummer; /* STORE THAT TO A DATA STRING */
$.ajax({ /* THEN THE AJAX CALL */
type: "POST", /* TYPE OF METHOD TO USE TO PASS THE DATA */
url: "get-data.php", /* PAGE WHERE WE WILL PASS THE DATA */
data: dataString, /* THE DATA WE WILL BE PASSING */
success: function(result){ /* GET THE TO BE RETURNED DATA */
$("#show").html(result); /* THE RETURNED DATA WILL BE SHOWN IN THIS DIV */
}
});
});
});
但是当页面加载时,您将看到激活此脚本的选择框,但是需要在de <div>
中显示的页面不可见。所以我想用<body onload="">
但我怎么能这样做?