1

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!

Joel Harris
  • 1,966
  • 3
  • 20
  • 32
  • 1
    you make it sound like it doesn't work on opera/safari for windows either... if so, it's not a Wii problem. Do you see that error message, or do you get nothing at all? – Kip Oct 22 '09 at 21:42
  • Could you please post the output you get if you go directly to DefaultWebService.asmx/Hello ? – Kip Oct 22 '09 at 21:47
  • The error message does not show up. No post is made to "DefaultWebService.asmx/Hello". I can't browse to "DefaultWebService.asmx/Hello" on the Wii. It just gives me a typical asp.net yellow screen of death because the web method expects the request to be formatted a specific way that is impossible to do from the browser on the Wii (to my knowledge). Thanks for looking. – Joel Harris Oct 22 '09 at 22:25

3 Answers3

2

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:

<?php
    if( $_SERVER['REQUEST_METHOD']=='POST' ){
        echo file_get_contents('php://input');
        exit;
    }
?>
    <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
    <script type="text/javascript">
    $.ajax({
    type: "POST",
    url: location.href,
    data: '{"test":"passed" }',
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) { alert(msg.test); },
    error: function() { alert("error while testing"); }
});
    </script>

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)

hallvors
  • 6,069
  • 1
  • 25
  • 43
0

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:

return "\"hello there\"";
Kip
  • 107,154
  • 87
  • 232
  • 265
0

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

Community
  • 1
  • 1
offner
  • 659
  • 3
  • 12
  • I saw that post and I'm doubtful that it applies here. The problem in that case was that a javascript object was being created with an unquoted object key. I'm trying to pass an empty object with no keys. – Joel Harris Oct 23 '09 at 02:49