lilman Posted August 4, 2007 Share Posted August 4, 2007 I am trying to request a file that will load in a div tag. Assume the div tag is there, can anyone point out what could be causing the problem. It works fine in Firefox, but not I.E.. Here is the Ajax code: <?php echo $_SERVER['PHP_SELF']; ?> <script type="text/javascript"> var xmlhttp=false; if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } var please_wait = "Please wait..."; function statusEnableDisable(url, targetId, form) { var status; if(form == "photoalbum"){ var object = document.getElementById('photoalbum').selectedIndex; if(object == "1"){ status = "Enabled"; } else if(object == "2"){ status = "Disabled"; } } else if(form == "file"){ var object = document.getElementById('filestorage').selectedIndex; if(object == "1"){ status = "Enabled"; } else if(object == "2"){ status = "Disabled"; } } url = url + "status=" + status; url = url + "&form=" + form; alert(url); if(!xmlhttp)return false; var e=document.getElementById(targetId); if(!e)return false; if(please_wait)e.innerHTML = please_wait; xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange = function() { response(url, e); } try { xmlhttp.send(null); } catch(l) { while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way e.appendChild(document.createTextNode("request failed")); } } function response(url, e) { if(xmlhttp.readyState != 4)return; var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText; if(xmlhttp.readyState == 4) { alert('complete'); } var d=document.createElement("div"); d.innerHTML=tmp; setTimeout(function() { while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way e.appendChild(d); },10) } </script> Link to comment https://forums.phpfreaks.com/topic/63291-solved-trying-to-load-a-file/ Share on other sites More sharing options...
almightyegg Posted August 4, 2007 Share Posted August 4, 2007 what url does it alert?? Link to comment https://forums.phpfreaks.com/topic/63291-solved-trying-to-load-a-file/#findComment-315502 Share on other sites More sharing options...
lilman Posted August 4, 2007 Author Share Posted August 4, 2007 http://www.pandoris.com/ijmeals/mystorage/php/updateEnableDisable.php?stauts=Enabled&form=photoalbum Link to comment https://forums.phpfreaks.com/topic/63291-solved-trying-to-load-a-file/#findComment-315624 Share on other sites More sharing options...
lilman Posted August 4, 2007 Author Share Posted August 4, 2007 Anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/63291-solved-trying-to-load-a-file/#findComment-315702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.