所以我正在做的是使用get resquest加载一些数据,我在httpRequest.responseText上获取此变量,我使用数据表来获得一些奇特的表,但问题是我无法在ajax:field上加载我的js var。
<script type="text/javascript">
var httpRequest = null;
function SendRequest () {
if (!httpRequest) {
httpRequest = CreateHTTPRequestObject (); // defined in ajax.js
}
if (httpRequest) {
// The requested file must be in the same domain that the page is served from.
var url = '/resources/ud_auto_executions';
httpRequest.open ("GET", url, true); // async
httpRequest.onreadystatechange = OnStateChange;
httpRequest.send (null);
}
}
function OnStateChange() {
if (httpRequest.readyState==4) {
if (IsRequestSuccessful (httpRequest)) { // defined in ajax.js
alert ("hello im coming");
}
else {
alert ("Operation failed.");
}
}
}
</script>
我在ajax上遇到麻烦:
<script>
$(document).ready(function() {
$('#example').DataTable( {
"AutoWidth": true,
"ajax": httpRequest.responseText