Antonio Gross - 2009-07-13 18:50:10
A booking system for language classes.
I have an html with several DIVs which exhibit HTML created by PHP.
One of them is a Booking PHP which shows a student's class schedule allowing updates, deletes and inserts. This is shown as HTML echo messages. Once the student has filled out the data, an UPDATE.PHP is called which does the DB processing and issues messages.
Of course the PHP takes over and the original HTML with all its DIVs disapppears. In order to force this output into a DIV thru Ajax I try to run JavaScript, without success. Here is a code schematic.
SCHOOL.HTML
<script type="text/javascript" src="Canuck.js"></script>
function book() {var now = new Date(); var hour = now.getTime();
var nm = document.getElementById("StdNo"); var nmval = nm.getAttribute("value");
getData('booking.php?StdNo=' +nmval+ '&a=' + hour + '','actual');
}
function carrega_loadurl(link,div) {
var vdiv = div; var vlink = link;
document.getElementById(vdiv).innerHTML = getData(vlink,vdiv);}
....
getData is the classic Ajax call. At the moment I am still using GET, but will switch to POST once I find out how to reach the function.
<div id="actual">...</div>
ALL OF THIS WORKS
Now here is booking.php:
<html><head><script type="text/javascript" src="Canuck.js"></script></head></html>
<?php
...
<td><a href=\"#\" onClick=\"carrega_loadurl('update.php','actual');\">Update</a></td>
...
All I get is Error on Page