0 Replies - 987 Views - Last Post: 07 August 2015 - 11:22 AM

#1 ybadragon  Icon User is offline

  • Home Owner
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,647
  • Joined: 11-May 12

Weird error returned from javascript, only in production...

Posted 07 August 2015 - 11:22 AM

Ok I have a utility that updates invoice dates and am receiving the following error from the Javascript portion but it also only happens in production, not on my development machine.

Uncaught Sys.ArgumentTypeexception: Sys.ArgumentTypeexception: Object of type 'String' cannot be converted to type 'Function'. Parameter name: onSuccess

Below is my javascript from last time it actually worked

function validate() {
var batchID = document.getElementById("batchID").value;
var transDate = document.getElementById("transDate").value;
batchID = parseInt(batchID);

PageMethods.UpdateInvoiceDates(batchID, transDate, function(d) {
if (d) {
alertify.alert("Your changes have been successfully saved.");
return false;
}
else {
alertify.alert("Something went wrong. Please check to make sure the Batch ID you entered is a valid ID.");
return true;
}
});
}



Then the method signature in my codebehind was the following

[WebMethod]
[ScriptMethod]
public static bool UpdateInvoiceDates(int BatchID, DateTime transDate)
{
.
.
.
}



below are the changes that I made and now it suddenly doesn't work (note the code behind never even get's called when)

Javascript:
function validate() {
var batchID = document.getElementById("batchID").value;
var transDate = document.getElementById("transDate").value;
var tablename = document.getElementById('<%= transType.ClientID %>').value;
batchID = parseInt(batchID);

PageMethods.UpdateInvoiceDates(batchID, transDate, tablename, function(d) {
if (d) {
alertify.alert("Your changes have been successfully saved.");
return false;
}
else {
alertify.alert("Something went wrong. Please check to make sure the Batch ID you entered is a valid ID.");
return true;
}
});
}



CodeBehind:
[WebMethod]
[ScriptMethod]
public static bool UpdateInvoiceDates(int BatchID, DateTime transDate, string tablename)
{
.
.
.
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1