Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLHttp Request Error - Whole page loads inside the other

Status
Not open for further replies.

wrighterb

Programmer
Feb 20, 2007
80
US
I am getting the whole page back inside my orginal page where I set the ID, I am just trying to pass back next months date so the just the calendar updates.

Click on right arrow and you will see

<script>

function createRequestObject() {
var req;
if(window.XMLHttpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// There is an error creating the object,
// just as an old browser is being used.
alert('Problem creating the XMLHttpRequest object');
}
return req;
}
// Make the XMLHttpRequest object
var http = createRequestObject();
function sendRequest(act) {
// Open PHP script for requests
http.open('get', 'rental_details.cfm?currdate=' + "#dateadd('m',1,currdate)#" + '&ID=' + '#ID#');
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse(){
if(http.readyState == 4 && http.status == 200){
// Text returned FROM the cfm
var response = http.responseText;
if(response) {
// UPDATE ajaxTest content
document.getElementById("ajaxTest").innerHTML = response;
}
}
}
</script>
<cfset counter = 1>

<table class="cal_Struct" id="ajaxTest">
<tr class="cal_Month">

<td class="stext" width=35>
<cfif datecompare('#month(now())#/1/#year(now())#',currdate)>
<a href="##" onClick="sendRequest();">
<img src="prev.gif" border="0" alt="Previous Month"></a><cfelse><img src="spacer.gif" width="35" height="2"></cfif></td>
<td class="stext" width=165><strong>#dateformat(currdate,'mmmm yyyy')#</strong></td>
<td class="stext" width=35><a href="##" onClick="sendRequest();"><img src="next.gif" border="0" alt="Next Month"></a></td>
<!--- <td class="stext" width=35>
<cfif datecompare('#month(now())#/1/#year(now())#',currdate)>
<a href="rental_details.cfm?ID=#ID#&currdate=#dateadd('m',-1,currdate)#">
<img src="prev.gif" border="0" alt="Previous Month"></a><cfelse><img src="spacer.gif" width="35" height="2"></cfif></td>
<td class="stext" width=165><strong>#dateformat(currdate,'mmmm yyyy')#</strong></td>
<td class="stext" width=35><a href="rental_details.cfm?ID=#ID#&currdate=#dateadd('m',1,currdate)#&arrive=#form.arrive#" ><img src="next.gif" border="0" alt="Next Month"></a></td> --->

</tr>
</table>

<table class="cal_Struct">

<tr bgcolor="ecf5fd">
<td class="stext" width="35"><strong>Su</strong></td>
<td class="stext" width="35"><strong>Mo</strong></td>
<td class="stext" width="35"><strong>Tu</strong></td>
<td class="stext" width="35"><strong>We</strong></td>
<td class="stext" width="35"><strong>Th</strong></td>
<td class="stext" width="35"><strong>Fr</strong></td>
<td class="stext" width="35"><strong>Sa</strong></td>
</tr>

<tr>
<cfloop from=1 to="#startdays#" index="sday">
<td class="cal_ededed">&nbsp;</td>
<cfset counter = counter + 1>
</cfloop>

<cfloop from="1" to="#daysinmonth(currdate)#" index="thisday">
<cfif listfindnocase(monthlist,'#month(currdate)#/#thisday#/#year(currdate)#') gt 0 OR datecompare('#month(currdate)#/#thisday#/#year(currdate)#',now()) lt 1>

<td class="cal_Red"><cfif thisday lt 10>0</cfif>#thisday#</td>
<cfelseif listfindnocase(pmonthlist,'#month(currdate)#/#thisday#/#year(currdate)#') gt 0>

<td class="cal_Yellow"><cfif thisday lt 10>0</cfif>#thisday#</td>
<cfelse>
<td class="cal_Green"><cfif thisday lt 10>0</cfif>#thisday#</td>
</cfif>

<cfif counter eq 7>
<cfset counter = 0>
</tr>
<tr>
</cfif>
<cfset counter = counter + 1>
</cfloop>
<cfif counter lte 7>
<cfset counter = 7 - counter>
<cfloop from=0 to="#counter#" index="eday">
<td class="cal_ededed">&nbsp;</td>
</cfloop>
</cfif>
</tr>
</table>
<cfset currdate = dateadd('m',1,currdate)>
<cfset currday = dayofweek(currdate)>
<cfset startdays = currday - 1>
<cfset columns = columns + 1>
</cfloop>
</td></tr></table>
</td>
</tr>
</table>
 
Then you are probably returning the whole page in the responseText. I suggest asking in the CFM forum where you've gone wrong delivering the right data to the callback function.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top