Hello again niroshan...
I am not seeing any error message. I will post all of the pertinent pieces of the code as it currently exists. (I'm not sure the code for "waking up jQuery" is correct, but I had read that this must be done after declaring it to make it work). Maybe the source of the problem lies there?
OK, here you go:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input.sponsorship")
.change(function(){
$("#"+this.value).text(
!this.checked? "" :
$(this).next().text().replace(/[\$]+/, "")
);
});
</script>
<script language="javascript">
function callAjax(obj)
{
if($('#'+obj).is(':checked'))
{
// call ajax
getData(dataSource, divID, data);
}
else
{
$('#di').val('');
}
}
</script>
<script language = "javascript">
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID, data)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("POST", dataSource);
XMLHttpRequestObject.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send("data=" + data);
}
}
</script>
The form's HTML:
<td valign="middle"><div align="left">
<input name="chk1" class="sponsorship" type="checkbox" id="chk1" value="1" onclick="callAjax('dataresponderpost.php?data=3500', 'DoubleEagle', 1)" /><label for="chk1"> Double Eagle Sponsor - $3500 - </label><a href="#" onclick="doDetails1()">details</a>
</div></td>
<td><div align="right" id="DoubleEagle"> </div></td>
I checked the dataresponder.php file and it is okay. It worked, but I just could not deal successfully with the "If they uncheck the checkbox, dismiss the price" event.
Now here is the code for the second checkbox. This was my way of making it work originally, and now this does not work either. That I do not understand. It's mysterious...
HTML:
<td><div align="left">
<input name="chk2" type="checkbox" id="chk2" value="1" onclick="DoCheck2()" />
Eagle Sponsor - $1800 - <a href="#" onclick="doDetails2()">details</a> </div></td>
<td><div align="right" id="Eagle"> </div></td>
Function called:
function DoCheck2() {
if(document.form1.chk2.checked == true) {
alert('Check1 is checked.');
dataSource = 'dataresponderpost.php?data=1800';
divID = 'Eagle';
data = 2;
getData(dataSource, divID, data);
}else {
//alert('Check1 is unchecked.');
dataSource = 'datarespondernull.php?data=0';
divID = 'Eagle';
data = 2;
getData(dataSource, divID, data);
}
}
Thanks for your continuing help to a rookie....🙂