I have a site that I have been working on recently. I am making a series of widgets for users of this site to add to his/her own site.
The problem I am having is getting my generated code to return any proper value. The error I get in Aptana is: Exception: Guest is not defined File:
http://egtworlds.com/!dev/widget/wid...=user-get-name Line: 1 Column: 0
Here is the file and code
http://egtworlds.com/!dev/widget/widgetcode.php?webid=1&type=user-get-name
That generated something like this:
Code:
var http_request991001 = false;
var elementName991001 = elementName991001;
document.write("<span name='elementName991001' id='elementName991001' class='egtWorldsWidget'></span>");
function makeRequest991001(url, parameters) {
http_request991001 = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request991001 = new XMLHttpRequest();
if (http_request991001.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request991001.overrideMimeType('text/xml');
http_request991001.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request991001 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request991001 = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request991001) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request991001.onreadystatechange = alertContents991001;
http_request991001.open('GET', url + parameters, true);
http_request991001.send(null);
}
function alertContents991001() {
if (http_request991001.readyState == 4) {
if (http_request991001.status == 200) {
//alert(http_request991001.responseText);
result991001 = http_request991001.responseText;
//alert(result991001);
document.getElementById(elementName991001).innerHTML = result991001;
} else {
alert('There was a problem with the request.' + http_request991001.status );
}
}
}
makeRequest991001('widget.php','?webid=1&type=user-get-name');
document.write('widget.php' + '?webid=1&type=user-get-name');
When you run the
ajax call you should get "
Guest (Log In)", (or the user name of the person who is logged in at the main site).
Please help me get this working, thanks in advance.