我有這樣的JSON:發送嵌套的Json到Web服務
var datatosend =
{
moduleID: '1',
data: { SomeData: 'SomeValue' }
};
並將其與此發送到Web服務:使用此功能
$.ajax({
type: "POST",
async: false,
url: SomeWebService,
data: datatosend,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (msg) {
elm.append(msg.d);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
alert(thrownError);
}
});
我剛剛得到一個錯誤:
[WebMethod(EnableSession = true)]
public string SomeFunction(int moduleID, object data) {
//do something
}
任何解決方案?
你什麼錯誤? –
@NilsMagneLunde用這段代碼我得到無效的json原語:moduleID ... – Raika