I have a WCF service exposing a JSONP interface by setting the CrossDomainScriptAccessEnabled property on the binding. There is an example with code similar to mine here. When the server would normally return HTTP 200 it behaves as I expected and returns javascript like jsonp_callback({"result":5}). However when I throw an exception the format is something like:
jsonp_callback({"error_message":"needs auth"}, 401);
The problem there is that as far as I can tell jQuery always expects a single parameter in the JSONP callback. Is there any way I can access the second parameter with jQuery’s JSONP handling? Is there another sensible framework that would make this easier?
I couldn’t find a way to do this with jQuery. But for my current purposes it worked fine implementing the JSONP myself: