请问如何在cgi函数中将一个数组或一段内存数据传递给javascript
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
请问如何在cgi函数中将一个数组或一段内存数据传递给javascript
{int i=0;printf("Content type: text/html\n\n");printf("%d",i);printf("|");}// JavaScript Documentfunction createXHR() { var xhr; try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(E) { xhr = false; } } if (!xhr && typeof XMLHttpRequest != 'undefined') { xhr = new XMLHttpRequest(); } return xhr;}function sender() { xhr = createXHR(); if(xhr) { xhr.onreadystatechange=callbackFunction; //xhr.open("GET", "test.cgi?cur_time=" + new Date().getTime()); xhr.open("GET","20120721.cgi?fuck"); setTimeout("sender()",1000); xhr.send(null); } else { alert("send create failure"); }}function callbackFunction(){ if (xhr.readyState == 4) { if (xhr.status == 200) { var returnValue = xhr.responseText; if(returnValue != null && returnValue.length > 0) { var arr=returnValue.split('|'); } else { alert("open failure"); } } else { alert("others"); } }}调用函数script_env.traceWrite,比如:
script_env.traceWrite("TEST COMPLETE. " +exceptionCount+ " exception happened!")