1. HTML, with javascript include statement in the header
2. AJAX controller file which points method calls from (1) to the correct PHP file in (3)
3. PHP file that does string manipulations, graph rendering, etc.
So here's the scenario. I have a simple HTML page that has an input form and submit button. The Submit calls a "render()" JS method which is read by the AJAX controller and calls a PHP page that renders and echos a graph back to the HTML page.
HTML
Code: Select all
<html>
<head><script type="text/javascript" src="ajax_controller.js"></script></head>
<body>
<form>
...
<input type='button' class="submitButton" id="submitButton" onClick='render(...)' value='Submit'/>
</form>
...
Code: Select all
var xmlhttp;
function render(...)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="graph.php"; // get the result and display
url=url+"?...="+X; // the team selection
url=url+"&...="+Y; // the stat selection
xmlhttp.onreadystatechange=getRender;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function getRender()
{
if (xmlhttp.readyState==4)
{
document.getElementById("...").innerHTML=xmlhttp.responseText;
}
}
Code: Select all
<?php>
....
echo $graph (...)
....
echo "<a href='#' onClick=\"render({$Y}+1, {$X});return false;\">Re-render</a>"; // TODO: Echo back new link that re-calls using AJAX
</?>
Thanks!
I've created a duplicate entry in the Javascript subforum since this may or may not deal with both languages. Once an answer solves my question or points me in the right direction, I shall delete the other. Thanks for understanding.