3.2.0

Can i make body script as an variable and pass it to div?, Ajax but not xmlhttprequest...

Page 1.php
*********
<?php
$html1 = 'This is test from internet explorer';
$html ="";

$html = "<script>
var table = new AW.CSV.Table;
table.setURL('companies.txt');
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(5);
obj.setCellModel(table);
document.write(obj);
</script>";

?>

div = document.getElementById('contentdiv');
div.innerHTML = '<?php echo $html1; ?>';

div = document.getElementById('gridDiv');
div.innerHTML = '<?php echo $html; ?>';
*****************************************
Page 1.Html
*********
<SCRIPT>
var x = 5
var y = 1
function startClock(){
    x = x-y
    setTimeout("startClock()", 700)
    window.status="";
    if(x==0){
        ajax_do ('page1.php');	
        window.status=x;	
        x=5;
    }
}
    
</SCRIPT>

<html>

    <head>
        <link href="aw.css" rel="stylesheet" type="text/css" >
        <script src="aw.js"></script>
        <script type="text/javascript" src="engine.js"></script>	
    </head>

    <BODY onLoad="startClock()">
        <DIV id="contentdiv"></div>
        <DIV id="gridDiv"></div>
    </body>

</html>
**************************************
engine.js
*******
// Get base url
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

var ajax_get_error = false;

function ajax_do (url) {
    // Does URL begin with http?
    if (url.substring(0, 4) != 'http') {
        url = base_url + url;
    }

    // Create new JS element
    var jsel = document.createElement('SCRIPT');
    jsel.type = 'text/javascript';
    jsel.src = url;

    // Append JS element (therefore executing the 'AJAX' call)
    document.body.appendChild (jsel);

    return true;
}

function ajax_get (url, el) {
    // Has element been passed as object or id-string?
    if (typeof(el) == 'string') {
        el = document.getElementById(el);
    }

    // Valid el?
    if (el == null) { return false; }

    // Does URL begin with http?
    if (url.substring(0, 4) != 'http') {
        url = base_url + url;
    }

    // Create getfile URL
    getfile_url = base_url + 'getfile.php?url=' + escape(url) + '&el=' + escape(el.id);

    // Do Ajax
    ajax_do (getfile_url);

    return true;
}


enavigator
September 25,

This topic is archived.

See also:


Back to support forum