My previously working update function now returns a 405 error when it is run. This is after I added the fileReader functionality to facilitate file uploading for a pictures. How could I now have a HTTP verb error (which is what 405 is to my understanding) if my ajaxCall is untouched from it's working form?
function update()
{
//picture specific upload stuff
var reader = new FileReader();
var file = $('#fileUpload')[0].files[0];
reader.readAsBinaryString(file);
//What is readerEvt?
reader.onload = function (readerEvt)
{
//get binary data then convert to encoded string
var binaryString = reader.result;
var encodedString = btoa(binaryString);
//normal update fields
emp = new Object();
emp.Title = $("#TextBoxTitle").val();
emp.Firstname = $("#TextBoxFirstname").val();
emp.Lastname = $("#TextBoxLastname").val();
emp.Phoneno = $("#TextBoxPhone").val();
emp.Email = $("#TextBoxEmail").val();
emp.StaffPicture64 = encodedString;
emp.Id = localStorage.getItem("Id");
emp.DepartmentId = localStorage.getItem("DepartmentId");
emp.Version = localStorage.getItem("Version");
}
ajaxCall("Put", "api/employees", emp)
.done(function (data) {
$("#myModal").modal("hide");
getAll(data);
})
.fail(function (jqXHR, textStatus, errorThrown) {
errorRoutine(jqXHR);
});
return false;
}