Reputation: 121
In this line of code:
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function () {
if(ajax.readyState == 4) {
function() {document.getElementById(f3).innerHTML = ajax.responseText};
}
};
This line:
...
function() {document.getElementById(f3).innerHTML = ajax.responseText};
...
is getting an error that the Function must be named.
This is the full scope of the code:
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function () {
if(ajax.readyState == 4) {
function() {document.getElementById(f3).innerHTML = ajax.responseText};
}
};
var urlToOpen = "~.$_tFileName.qq~?pg=admin_main&load=subscriptionAdmin&view=setANewVar&n=" + f1 + "&v=" + f2 + "~.$SessId.q~" + "&stopIEcache=" + Math.floor(Math.random()*99999);
ajax.open("GET", urlToOpen, true);
ajax.send(null);
The Tilde Marks (~) are because this file is built with Perl syntax. the output is a full url... for example:
https://www.google.com/search?pg=admin_main&load=subscriptionAdmin&view=setANewVar&n= of course it is not on Google... just put that url instead of the real one.
Can you tell me what is wrong with that line? and how I can make it work?
Thank you. Rich
Upvotes: 0
Views: 41
Reputation: 37806
Remove function()
it's unnecessary to have it there
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function () {
if(ajax.readyState == 4) {
document.getElementById(f3).innerHTML = ajax.responseText
}
};
var urlToOpen = "~.$_tFileName.qq~?pg=admin_main&load=subscriptionAdmin&view=setANewVar&n=" + f1 + "&v=" + f2 + "~.$SessId.q~" + "&stopIEcache=" + Date.now();
ajax.open("GET", urlToOpen, true);
ajax.send(null); // PS. you can also remove null -> ajax.send();
Upvotes: 2