views:

1077

answers:

1

Hi all,

I'm uisng JQuery 1.3.2 and having problems with something that used to seem to work.

I'm making a call to a WCF service in another domain. My call is hitting my service and getting back a valid JSON object, but I keep getting this "invalid label" error.

var url = "http://.../GetEmployee?callback=?";

$.getJSON(url2,{empolyeeNo:42}, function(data) { alert("works!"); });

=1246048755308&echoThis=42">http://.../GetEmployee?callback=jsonp1246048506475&=1246048755308&echoThis=42

The response I see in the Firebug console is: Firebug's log limit has been reached. %S entries not shown. Preferences invalid label [Break on this error] {"d":"You sent this 42"}

Does anyone have any idea what I might be doing wrong? I've been around and around shown it to a couple JQuery guys. Nobody seems to know what the problem could be.

Full disclosure: App is .NET 3.5 w/ WCF server and an ASP.NET MVC application.

Thanks,

+1  A: 

WCF / ASP.NET deliberately returns a JSON string you cannot call eval on, because eval on JSON calls is insecure and leaves you open to JSON hijacking, you should be using a JSON parser

If you want to leave yourself open to vulnerabilities and still use eval then you can wrap it

var response = eval( '(' + jsonString + ')' );

But really, use a parser.

blowdart