i guess your experiencing the "same origin policy" problem here, which
lets you only load data/whatever via ajax from the same origin as the
calling page! it seems that the origin isnt just the domain but also
the used port.

so to make this work you could either use a "new" http header field
which will only work in firefox 3.5+ (http://www.petefreitag.com/item/
703.cfm) or you have to make your call with "JSONP" (http://
en.wikipedia.org/wiki/JSON#JSONP). i believe jQuery natively supports
jsonp, never used it though.

On 26 Nov., 10:58, Darjana <darj...@gmail.com> wrote:
> Hello,
>
> This user.php on port 80
> $callback = $_GET["callback"];
> $user = $_GET["username"];
>
> if($user == "lazy") {
>   $response = array("message" => "SUCESS");} else {
>
>   $response = array("message" => "FAIL");
>
> }
>
> echo $callback . "(". json_encode($response) . ");";
>
> This is index.html on port 8080
>
> $.getJSON("user.php?callback=?", { username: "lazy"}, function(json){
>   alert("JSON Data: " + json.message); // SUCCESS
>
> });
>
> This is working if both files on same port, however, it doesn't when
> its not on same port
>
> Any workaround for this to work?

Reply via email to