This page when submitted normally will return a graph with the parameters using the Start and End date and the Staff ID. When I click the button it does nothing. However if I change the url section to message.txt and type to GET the DIV is replaced by the text inside message.txt. Where have I gone wrong?
Ok here is my code:
Ok here is my code:
Code:
<script type="text/javascript">
function validate(StartDate, EndDate, varStaffID)
{
$.ajax({
type: "POST",
url: "mygraph.asp",
data: { StartDate: $("#StartDate").val(), EndDate: $("#EndDate").val(), varStaffID: $("#varStaffID").val() },
success: callback
});
}
function callback(data, status)
{
$("#foo").text(data);
}
</script>
Start Date: <input type='text' name='StartDate' size='9' id='startdate' maxlength='25'>
End Date: <input type='text' name='EndDate' size='9' id='enddate' maxlength='25'>
<input type="hidden" name="varStaffID" value="12345">
<input type="Submit" value="Show Graph" OnClick="validate(document.getElementById('startdate').value,document.getElementById('enddate').value,document.getElementById('varStaffID').value)" />
<div id="foo"></div>