sb.attachURL('List.php');
So i cant load php files with that, it returns them as plain text instead of parsing the data.
So i used a html file with a JavaScript function to use AJAX with a POST call. Again, it does not work, it returns the ajax file as plain text.
Am i missing a step or will this system not work with basic AJAX?
JavaScript function
<script type="text/javascript">
function loadList()
{
var params = '&m=lpt';
try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {
try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(oc) { req = null; }
}
if (req == null && typeof XMLHttpRequest != "undefined")
req = new XMLHttpRequest();
if (req != null)
{
req.open("POST", 'ajax.php', true);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length);
req.setRequestHeader("Connection", "close");
req.onreadystatechange = function() {if (req.responseText != '') { document.getElementById('List').innerHTML = req.responseText;}};
req.send(params);
}
}
//------------------------------------------------------------------------------------------------------------------
</script>
HTML
<input type="button" value="load patients" onclick="loadList();" />
<div id="List" style="height:100%">...</div>
AJAX (PHP)
if ($_POST['m'] == 'lpt')
{
include('List.php');
}
So simple of a request, now the List.php file connects to a database and prints out all of the data, so it is basic functions. This script returns the actual code from the AJAX(PHP) section, as plain text.
How do you go about executing it? Is simple stuff to trivial for the high-tech products?