AJAX form tag problem
function makeRequest(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/php');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.open('GET', url, true);
http_request.onreadystatechange = alertContents;
http_request.send(null);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
alert(http_request.responseText);
document.getElementById('maintext').innerHTML=http_request.responseText;
} else {
alert('There was a problem with the request.');
}
}
}
/*And here's the HTML that should be passing the code*/
<td class="back">
<div class="topbar" width="auto" onclick="makeRequest('edit_act.php')">
<center>Edit Activity</center>
</div>
</td>
/*and here's the code it should be posting, edit_act.html*/
<table>
<form action="add_act.php" method="post"> /*if i delete this form tag, the page displays properly, but then i can't post the info in the form to the database. add_act.php is just a script that posts the info to the database*/
<tr>
<td>Location:</td>
<td><input type="text" name="location" tabindex="1"></td>
<td>Date:</td>
<td><input type="text" name="date" tabindex="2"></td>
</tr>
<tr>
<td>Duration(Nights):</td>
<td><input type="text" name="duration" tabindex="3"></td>
<td>Description:</td>
<td><input type="text" name="description" tabindex="4"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Add this Activity" tabindex="18" accesskey="enter"></td>
<td><input type="reset" name="reset" value="Start over" accesskey="escape"></td>
</tr>
</form>
</table>

