2 つのパラメーターを渡すときに、jquery から WCF 呼び出しを機能させることができません。コードを少し変更して、1 つだけを渡すと問題なく動作します。
Javascript:
$.ajax({
type: "POST", //GET or POST or PUT or DELETE verb
url: "/Services/JobNumberService.svc/GetActiveJobNumberByCustomerOrJointBilling", // Location of the service
data: '{"customerId": "' + customerId + '", "departmentId": "' + departmentId + '"}', //Data sent to server
contentType: "application/json; charset=utf-8", // content type sent to server
dataType: "json", //Expected data format from server
processdata: true, //True or False
success: function (msg) {//On Successfull service call
fillDropDownFromLookupList(msg, jobNumberDropDownId);
prependItemToDropDown('', 'NONE', jobNumberDropDownId); //Add blank item to top of list
},
error: ServiceFailed// When Service call fails
});
サービス署名:
public LookupList GetActiveJobNumberByCustomerOrJointBilling(int customerId, int departmentId)
渡されたjsonをフォーマットする方法に何かが必要です。JSONLintによれば有効ですが、.netが期待するものではないかもしれません。
アイデアを歓迎します。
編集
これは私が応答で返すものです
HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/11.0.0.0
Date: Thu, 28 Feb 2013 20:30:17 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Length: 0
Connection: Close
また、エラーの原因を追跡するためにコードのデバッグだけをオフにしようとしましたが、何らかの理由で例外が表示されませんでした。