Hi, I have an ajaxified .NET webservice that I call from javascript(mootools) on my ASP.NET content page with a Masterpage firstly to check if the user has associated journalists, secondly to delete the user if no journalists are associated.
Both calls to the webservice work, but the onComplete for the second does not in IE8. Using FF 3.5.3 I get a "deleteUserInt is not defined" error in firebug.
I have read around that this can be a sytax error, but cannot seem to see it.
Please help.
<script type="text/javascript">
var userId;
var siteName;
var siteFolder;
function userInternalHasUserExternals() {
siteName = document.location.href.split("/")[document.location.href.split("/").length - 1];
siteFolder = document.location.href.replace(siteName, "");
var jsonRequest = new Request.JSON({ url: siteFolder + "Service1.asmx/UserInternalHasUserExternals",
onComplete: onComplete,
onFailure: onError,
urlEncoded: false,
headers: { "Content-type": "application/json" }
});
userId = document.getElementById("<%= HiddenId.ClientID %>").innerText;
jsonRequest.send(JSON.encode({ 'userInternalId': userId }));
}
function onComplete(results) {
var fullname = document.getElementById("<%= fullnameTextBox.ClientID %>").value;
if (results != null && results["d"] != null && results["d"]) {
alert("Du kan ikke slette " + fullname + ". Kontoen har journalister tilknyttet.");
return false;
}
var deleteUser = confirm("Er du sikker på du vil slette " + fullname + "?");
if (deleteUser) {
deleteUserInt();
window.location = window.siteFolder + "CreateUserInternal.aspx?IsDeleted=true";
}
else
window.location = window.siteFolder + "EditUserInternal.aspx?UserInternalId=" + window.userId;
}
function deleteUserInt() {
var request;
request = new Request.JSON({ url: window.siteFolder + "Service1.asmx/DeleteUserInternal",
onComplete: onDeleted,
onFailure: onError,
urlEncoded: false,
headers: { "Content-type": "application/json" }
});
request.send(JSON.encode({ 'userInternalId': window.userId }));
}
function onDeleted(args) {
if (args != null && args["d"] != null && args["d"])
window.location = window.siteFolder + "CreateUserInternal.aspx?IsDeleted=true";
else
alert("Der skete en fejl. Kontakt venligst site administrator.");
}
function onError() {
alert("Something bad happened!");
}