I'm trying to display a widget that is called through another page. The "test" word shows up, but the WIDGET portion does not. I know the address works, I can call it through the url and it displays fine so that's not the problem. It's something within the javascript.
Here's my code:Can anyone see what's wrong with it?Code:<script type="text/javascript"> httpRequest("www.addressto/xxx/xxx/recent-widget.php", showrecent); //Function to display the widget within innerHTML function showrecent(WIDGET){ d = document.getElementById('recent-widget'); d.innerHTML = "test" + WIDGET; } //Function to call HTTPRequest function httpRequest(url, callback) { var httpObj = false; if (typeof XMLHttpRequest != 'undefined') { httpObj = new XMLHttpRequest(); } else if (window.ActiveXObject) { try{ httpObj = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { try{ httpObj = new ActiveXObject('iMicrosoft.XMLHTTP'); } catch(e) {} } } if (!httpObj) return; httpObj.onreadystatechange = function() { if (httpObj.readyState == 4) { // when request is complete callback(httpObj.responseText); } }; httpObj.open('GET', url, true); httpObj.send(null); } </script> </head> <body> <!-- Div for innerhtml --> <div id="recent-widget"></div> </body> </html>


Reply With Quote

Bookmarks