views:

346

answers:

1
$.getJSON(service + "/GetJobTags", 
    { tag: "a" }, 
    function(json) {
        $.each(json, function(i,val) { 
            alert(val.Title); 
        }); 
     });

It calls:

http://127.0.0.1:20087/ClientService.svc/GetJobTags?tag=a

This is probably of note, the service is running on a different port to the client application, which is on:

http://127.0.0.1:32017/index.htm

Firefox says HTTP 200 OK but the response data is null (and it highlights in red in Firebug). In IE it works fine, and the server is returning json.

Is this a permissions problem? Do I need to use JSONP?

+4  A: 

The use of different ports is definitely against the Same Origin Policy in Firefox: Source Here

Maybe document.domain helps, I'm not sure: I can't find anything confirming it can help reach across ports as well.

Update: The feedback to this SO question suggests that JSONP or using a proxy server-side script are indeed the only ways to go.

Pekka
awesome. thanks for that. i'll look into the .net implementation of handling jsonp
i used this guide: http://bendewey.wordpress.com/tag/wcf/ and it worked a treat.