D
DonO
Hopefully something here will jump out at someone. I can't find out
why this doesn't show any errors in FF, but in IE, it throws an error.
I have a page with the following code...
<html>
<head>
<title>whatever</title>
<script type="text/javascript">
function createRequestObject() {
if(navigator.appName == "Microsoft Internet Explorer"){
var ro = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
var ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function handleResponse(inUpdateDiv) {
if (http.readyState == 4) {
var response = http.responseText;
if (http.status == 200) {
document.getElementById(inUpdateDiv).innerHTML = response;
}
else {
alert('There was a problem with the request.');
}
}
}
function build_employee_info() {
http.open('get', '/_ajax/AJAX_display_emp_profile_info.php');
http.onreadystatechange = function (){
handleResponse('ajax_employee_profile_info');
}
http.send(null);
}
// remove item from tblEmployeeInfo
function removeEmpData (inID) {
if(confirm_delete()){
var urlString = "";
if(inID != ''){
urlString += "&uid=" + inID;
http.open('get', '/_ajax/AJAX_update_profile.php?
action=rm'+urlString);
http.onreadystatechange = function (){
build_employee_info();
}
http.send(null);
}
}
}
</script>
</head>
<body onload="build_employee_info()">
{misc html}
<!-- this is where the ajax call drops in the results -->
<div id="ajax_employee_profile_info" style="clear:both;"></div>
</body>
</html>
The PHP page "AJAX_display_emp_profile_info.php" just does a DB call
and loads the current info for an employee's profile. There are links
to Add/Edit/Remove items in the content that pulls in. If you click a
link to do the "Remove", it will call the "removeEmpData()" function
above. This call is a second AJAX call to go in and remove the data
from the database. When it finishes, it should return to the
build_employee_info() which will refresh all the info in the <div
id="ajax_employee_profile_info"> tag.
It works fine in FF, but not IE 6. IE loads the info fine initially
but errors on any of the edits (though it does run the php ok, so if I
say "No" to show debugging, it eventually gets to the end result.)
Saying "yes" to show debugging takes me to the line...
http.open('get', '/_ajax/AJAX_display_emp_profile_info.php');
I am wondering if it can't refresh the area that is making the call
for some reason. I'm new to the whole Asynchronous connection, so I
may be way off. Any guidance is appreciated.
Thanks,
D.
why this doesn't show any errors in FF, but in IE, it throws an error.
I have a page with the following code...
<html>
<head>
<title>whatever</title>
<script type="text/javascript">
function createRequestObject() {
if(navigator.appName == "Microsoft Internet Explorer"){
var ro = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
var ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function handleResponse(inUpdateDiv) {
if (http.readyState == 4) {
var response = http.responseText;
if (http.status == 200) {
document.getElementById(inUpdateDiv).innerHTML = response;
}
else {
alert('There was a problem with the request.');
}
}
}
function build_employee_info() {
http.open('get', '/_ajax/AJAX_display_emp_profile_info.php');
http.onreadystatechange = function (){
handleResponse('ajax_employee_profile_info');
}
http.send(null);
}
// remove item from tblEmployeeInfo
function removeEmpData (inID) {
if(confirm_delete()){
var urlString = "";
if(inID != ''){
urlString += "&uid=" + inID;
http.open('get', '/_ajax/AJAX_update_profile.php?
action=rm'+urlString);
http.onreadystatechange = function (){
build_employee_info();
}
http.send(null);
}
}
}
</script>
</head>
<body onload="build_employee_info()">
{misc html}
<!-- this is where the ajax call drops in the results -->
<div id="ajax_employee_profile_info" style="clear:both;"></div>
</body>
</html>
The PHP page "AJAX_display_emp_profile_info.php" just does a DB call
and loads the current info for an employee's profile. There are links
to Add/Edit/Remove items in the content that pulls in. If you click a
link to do the "Remove", it will call the "removeEmpData()" function
above. This call is a second AJAX call to go in and remove the data
from the database. When it finishes, it should return to the
build_employee_info() which will refresh all the info in the <div
id="ajax_employee_profile_info"> tag.
It works fine in FF, but not IE 6. IE loads the info fine initially
but errors on any of the edits (though it does run the php ok, so if I
say "No" to show debugging, it eventually gets to the end result.)
Saying "yes" to show debugging takes me to the line...
http.open('get', '/_ajax/AJAX_display_emp_profile_info.php');
I am wondering if it can't refresh the area that is making the call
for some reason. I'm new to the whole Asynchronous connection, so I
may be way off. Any guidance is appreciated.
Thanks,
D.