Hi Guys,
I'm in need of a paginator at the bottom of a table which is being returned by Ajax's responseText. I'm having trouble as I can't seem to hook up the JavaScript with the one being produced by Ajax. I know some of you will say I need to use jQuery UI, but it's a little late for that as this is the last thing I need to implement.
Also the data is being driven using PHP and MagicParser which works fine. I would prefer not to use a server-side paginator as I'll have to deal with the form's control values which would require more work. I figured I could manipulate the HTML coming back from the server. The name of the <div> that will contain the returned Ajax HTML is called "dynamic_display". Here's the index page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="zh-HK" />
<title>Cantab Education: Timetable</title>
<script type="text/javascript">
function showCourse(search, key)
{
if (search == "") {
document.getElementById("dynamic_display").innerHTML = "";
return;
}
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("dynamic_display").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "search.php?key="+ key +"&search=" + search, true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<table id="search">
<tr>
<th>
<label>Subject: </label>
<select name="subject" onchange="showCourse(this.value, 'Subject');">
<option selected="selected" value=""></option>
<option value="A%20Math">A Math</option>
<option value="BAFS(A)">BAFS(A)</option>
<option value="BAFS(Acc)">BAFS(Acc)</option>
<option value="English">English</option>
</select>
</th>
<th>
<label>Tutor: </label>
<select name="tutor" onchange="showCourse(this.value, 'Tutor');">
<option selected="selected" value=""></option>
<option value="A.Yiu">A. Yiu</option>
<option value="Alan%20x%20Cars">Alan x Cars</option>
<option value="Ally">Ally</option>
<option value="Peter%20Chow">Peter Chow</option>
<option value="Super%20English%20Force">Super English Force</option>
</select>
</th>
<th>
<label>Level: </label>
<select name="level" onchange="showCourse(this.value, 'Level');">
<option selected="selected" value=""></option>
<option value="Form%201">Form 1</option>
<option value="Form%202">Form 2</option>
<option value="Form%203">Form 3</option>
</select>
</th>
<th>
<label>Type: </label>
<select name="type" onchange="showCourse(this.value, 'Course Type');">
<option selected="selected" value=""></option>
<option value="Summer">Summer</option>
<option value="Regular">Regular</option>
</select>
</th>
<th>
<label>Center: </label>
<select name="center" onchange="showCourse(this.value, 'Primary Center');">
<option selected="selected" value=""></option>
<option value="CB%20-%20Cantab%20Education%20Centr%20(Causeway%20Bay)">Causeway Bay</option>
<option value="FT%20-%20Cantab%20Education%20Centr%20(Fo%20Tan)">Fo Tan</option>
<option value="HH%20-%20Cantab%20Education%20Center%20(Hung%20Hom)">Hung Hom</option>
</select>
</th>
</tr>
</table>
</form>
<div id="dynamic_display"></div>
</body>
</html>
Can anyone point me in the right direction, perhaps with some sample code?
Thanks,
Julian