我如何從jquery調用wcf服務(我正在使用asp.net mvc)。這是我用ASMX web服務做:如何從jQuery調用WCF Web服務?
$.ajax({
type: "POST",
url: "Services/MyService.asmx/DoSomething",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
//do the magic
}
});
我如何做同樣的WCF服務?
@Yassir:這是http://stackoverflow.com/questions/608006/where-am-i-going-wrong-in-calling-asmx-web-methods-from-jquery的副本。你可能沒有意識到,但你並沒有調用WCF,而是傳統的ASMX服務。這就是爲什麼它說「.asmx」。 – 2009-07-05 00:30:32
@John Saunders:我知道我發佈的代碼是什麼,我通常打電話給asmx服務,現在我想要幫助wcf :)(這不是重複的:d) – 2009-07-05 00:36:07