AJAX Issue



I am using AJAX XMLhttprequest to request another page on form submit
and I am loading that page into a span tag. My issue is that I have
more js in the called page that loads a calendar on click of a text
box. This calendar never loads in my page but if I call the page by
itself in a new window javascript works fine, any ideas? See Below
when you call index and click the button the page does not show the
alert, when you call getcall straight the alert shows fine.


index.asp
<form name="new" method="Post"
action="javascript:get(document.getElementById('new'),'new');">
<input type="Submit" name="Submit" value="Enter New Call"><br>
</form>
<span name="call_results" id="call_results"></span>

getcall.asp
<SCRIPT type="text/javascript">
alert("here");
</SCRIPT>

js.
/* AJAX on form submit */
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} 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('Cannot create XMLHTTP instance');
return false;
}

http_request.onreadystatechange = alertContents;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
toggleT('call_mainscreen','h')
}

function alertContents() {
//if (http_request.readyState == 4) {
//if (http_request.status == 200) {
//alert(http_request.responseText);
// result = http_request.responseText;
// document.getElementById('call_results').innerHTML = result;

//} else {
// alert('There was a problem with the request.');
//}
//}
if (http_request.readyState == 4) {
strResponse = http_request.responseText;
switch (http_request.status) {
// Page-not-found error
case 404:
alert('Error: Not Found. The requested URL ' +
strURL + ' could not be found.');
break;
// Display results in a full window for server-side errors
case 500:
handleErrFullPage(strResponse);
break;
default:
// Call JS alert for custom error or debug messages
if (strResponse.indexOf('Error:') > -1 ||
strResponse.indexOf('Debug:') > -1) {
alert(strResponse);
}
// Call the desired result function
else {
result = http_request.responseText;
document.getElementById('call_results').innerHTML = result;
}
break;
}
}
}
function handleErrFullPage(strIn) {

var errorWin;

// Create new window and display error
try {
errorWin = window.open('', 'errorWin');
errorWin.document.body.innerHTML = strIn;
}
// If pop-up gets blocked, inform user
catch(e) {
alert('An error occurred, but the error message cannot
be' +
' displayed because of your browser\'s pop-up
blocker.\n' +
'Please allow pop-ups from this Web site.');
}
}
function get(obj,itype) {
var poststr = "type=" + itype + "&value=test";
makePOSTRequest('getcall.asp', poststr);
}

.



Relevant Pages

  • Re: How do I request mail merge data?
    ... A better option would be to create a template with a combobox or listbox to display the data and from which you can select the record that you want and then click on a button to transfer that data into the document created from the template. ... and the following pages of fellow MVP Greg Maxey's website: ... how do I request the data from the spreadsheet I used as the data ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Display "waiting" pages while long running operations complete
    ... You could definitely achieve some thing like this using AJAX, ... server's busy working on their request. ... As it says in the title, I'm looking for a way to display a page while ... That "waiting" page would periodically poll to see if the main ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Help - Need a Macro/Popup to Find a Date in a Sheet.
    ... Button to clcik to open a data entry box. ... request is for months ahead, currently I have to scroll down to the requested ... User Clicks a command button that will then display an InputBox. ...
    (microsoft.public.excel.programming)
  • Re: Handling requests that have a long response time
    ... > and display the results. ... > a) Redirect to a new "Please wait" page till the processing is done, ... > b) Display a "Please wait" message on the same page that sends the request ... > to the server and refresh the page to display the results. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: In-flight IFR Flight Plan
    ... as well as decline your request to file a pop-up, ... >> to attempt this request with a center or very busy approach controller. ... different aircraft on VFR flight following attempt to get a pop-up IFR ...
    (rec.aviation.student)