I am attempting to delete a store via AJAX. When I try to run my code, it does not run successfully. I have used the debug application in Internet Explorer, and found that rather than "objRequest.status == 200", which is what I need to run the lines of code within the if statement, I get "objRequest.status == 404" I am having a very hard time finding out what is wrong with it. Could you help me find out what I did wrong?
function DeleteStore()
{
var objRequest = new XMLHttpRequest();
var url = "http://student.business.uab.edu/webappservice/service1.svc/DeleteStore";
//Collect Customer data from web page
var deletestoreid = document.getElementById("deletestoreid").value;
//Create the parameter string
var detelenewstore = '{"StoreID":"' + deletestoreid +'"}';
//Checking for AJAx operation return
objRequest.onreadystatechange = function()
{
if (objRequest.readyState == 4 && objRequest.status == 200) //This is where the arro occurs in my debugging
{
var result = JSON.parse(objRequest.responseText);
DeleteInfo(result);
}
}
//Start AJAX request
objRequest.open("GET", url, true);
objRequest.send();
}
function DeleteInfo(output)
{
if (output.WasSuccessful == 1)
{
document.getElementById("youmonster").innerHTML = "You've just killed a perfectly innocent store! You monster!"
}
else
{
document.getElementById("youmonster").innerHTML = "Aw Snap! The operation was not successful!" + "<br>" + output.Exception;
}
}