Opera、Wii、Ajax、Jquery 和 asp.net
我已经编写了一个支持 ajax 的网页,旨在在我的 Wii 上使用。然而,ajax 似乎无法在 Wii 的 Opera 浏览器上运行。此页面适用于 IE、Chrome 和 FF,但不适用于 Safari 或 Opera。 这是我的 jQuery 测试 ajax 调用:
$.ajax({
type: "POST",
url: "DefaultWebService.asmx/Hello",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) { alert(msg.d); },
error: function() { alert("error in DefaultWebService.asmx/Hello"); }
});
这是我的测试 Web 服务方法:
[WebMethod]
public string Hello()
{
return "hello there";
}
我的 Web 服务器日志中没有对 DefaultWebService.asmx 的调用,因此浏览器甚至不会尝试发出 ajax 请求。
是否有任何解决方法可以使其在 Wii 上运行? 谢谢!
I've written an ajax-enabled web page intended for use on my Wii. However, ajax doesn't appear to work on the Wii's Opera browser. This page works in IE, Chrome and FF, but not in Safari or Opera.
Here is my jQuery test ajax call:
$.ajax({
type: "POST",
url: "DefaultWebService.asmx/Hello",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) { alert(msg.d); },
error: function() { alert("error in DefaultWebService.asmx/Hello"); }
});
Here is my test web service method:
[WebMethod]
public string Hello()
{
return "hello there";
}
There are no calls to DefaultWebService.asmx in my web server logs, so the browser isn't even trying to make the ajax request.
Are there any work-arounds available to get this working on the Wii?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个月后,我希望您能找到解决方案,但如果您还没有找到,我愿意提供帮助。我写了一个非常基本的测试,就是这样:
但它在我尝试过的 Opera 版本中确实工作得很好(包括一些可能与 Wii 版本一致的早期 9.x 版本 - 我不确定最接近的桌面是什么等价的是)
after a month I hope you've found the solution, but if you haven't I'd like to help out. I wrote a pretty basic test, just this:
but it does work just fine in the Opera versions I tried it in (including some early 9.x versions that might be aligned to the Wii one - I'm not sure what the closest desktop equivalent is though)
您是否尝试过更改发布的数据?这看起来与此处发布的问题类似(尽管显然不相同): jQuery 语法错误关于 Opera 中的 POST
Have you tried changing the data being posted? This looks similar (though obviously not identical) to the issue posted here: jQuery syntax error on POST in Opera
对ASP不太熟悉..会不会需要对返回值进行JSON编码?或者“
[WebMethod]
”会处理这个问题吗?试试这个:Not too familiar with ASP.. could it be that you need to JSON encode the return value? Or does "
[WebMethod]
" take care of that? Try this: