サーバーにクロスドメイン jquery ajax リクエストを送信しています。
$.ajax({
beforeSend: function (xhr) {
xhr.withCredentials = true;
},
data: data,
type: "GET",
url: requestUrl,
xhrFields: {
withCredentials: true
},
async: true,
dataType: 'json',
crossDomain: true
};
送信されるデータ オブジェクトの形式は次のとおりです。
var data = {
Customer: { id: 1 },
Order: { id: 1 }
};
データは JSON.stringify(data) で変換され、サーバーに送信されます。
サーバーには、次のリクエスト オブジェクトがあります。
public class RequestObject
{
public CustomerRef Customer { get; set; }
public OrderRef Order { get; set; }
}
両方のオブジェクトにはまだ id プロパティがあります。
サーバー側でデバッグすると、リクエスト オブジェクトが作成されますが、プロパティ Customer と Order の両方が null です。
データ オブジェクトにパラメータを指定してデータをリクエスト (GET) しています。
私の送信したURLは次のようになります。
http://localhost:82/json/reply/MyService?{%22Customer%22:{%22id%22:1},%22Order%22:{%22id%22:1}}
私は何を間違っていますか?