解析可能な JSON を返していないためだと思われます。以下にサンプルを示します。
Response.ContentType = "application/json";
Response.Write(JsonConvert.SerializeObject(new {foo="bar"}));
Chrome は次のように伝えます...「Uncaught SyntaxError: Unexpected token :」
このアプローチでは、同じ応答が得られます。
return Json(new {foo="bar"}, JsonRequestBehavior.AllowGet);
私は何を間違っていますか?また、これはクロス ドメイン リクエストです。
$.ajax({
url: myURL,
type: 'GET',
async: true,
dataType: 'jsonp',
cache: false,
success: function (data) {
alert(data);
}
});
編集: JSON C# が吐き出すのは次のとおりです。
{"foo":"bar"}