You'd be safer outputting your JSON in the responseText rather than in
a header.

Regards,

Tobie

On Apr 26, 4:55 am, nihaopaul <[EMAIL PROTECTED]> wrote:
> i've been trying my hardest to work out why the following doesn't work
> on safari but works well with FF and the evil IE..
>
> new Ajax.Request('/include/dynamic.php?Login', {
>  method: 'get',
>   requestHeaders: {Accept: 'application/json'},
>   evalScripts: true,
>   onSuccess: function(transport, json){
>      if (json.length>0 && json.length!=undefined) {
>         for (var i=0; i<json.length; i++) {
>            objHolder.push([json[i].name, json[i].node, json[i].replacement])
>         }
>       } else if (json.length == undefined && json.name != undefined) {
>         objHolder.push([json.name, json.node, json.replacement])
>       }
>    }
>
> });
>
> which calls the dynamic.php for its login scripts that returns:
>
> HTTP/1.0 200 OK
> Connection: close
> X-Powered-By: PHP/5.2.1
> Content-type: application/json
> X-JSON: [{"name":"recover","node":"login","replacement":"<form method=
> \"post\"
> name=\"recover\" action=\"\" onsubmit=\"do_recover(this); return false;
> \">\
> t<fieldset title=\"Recover your password\"><legend>Recover your
>  password<\/legend><label>Login:<\/label><input t
> ype=\"text\" id=\"Login\" onchange=\"return modify(this);\" alt=\"Login
> \" tabin
> dex=\"1\" \/><br \/><label>Email:<\/label><input
> type=\"text\" id=\"Email\" onchange=\"return modify(this);\" alt=
> \"Email\" tabi
> ndex=\"2\" \/><br \/> <input type=\"button\" class=\"cancel
>  button\" id=\"Cancel\" onclick=\"dyn_feature('login'); return false;
> \" value=\
> "Cancel\" tabindex=\"4\" \/><input type=\"submit\" class=\"recover bu
> tton\" id=\"Recover\" value=\"Recovery\" tabindex=\"3\" \/><\/
> fieldset>
> <\/form>"},{"name":"login","node":"login","replacement":"<form method=
> \"post\"
> name=\"login\" action=\"\" onsubmit=\"do_login(this); return false;\">
> \
> t<fieldset title=\"Login\"><legend>Login to AMHE<\/legend>\
> r<label>Login:<\/label><input type=\"text\" id=\"Login\" onch
> ange=\"return modify(this);\" alt=\"Login\" tabindex=\"1\" \/><br \/>
> <label>Passphrase:<\/label><input type=\"password\" id=\"Pa
> ssphrase\" onchange=\"return modify(this);\" alt=\"Password\" tabindex=
> \"2\" \/><br \/><input type=\"button\" class=\"recovery button\" id
>
> =\"Recover\" onclick=\"dyn_feature('recover'); return false;\" value=
> \"Recovery
> \" tabindex=\"4\" \/><input type=\"submit\" class=\"okay button\" id=
> \"Okay\" value=\"Okay\" tabindex=\"3\" \/><\/fieldset><\/form>"}]
> Date: Thu, 26 Apr 2007 08:51:45 GMT
> Server: lighttpd/1.4.13
>
> under Firefox/ie it loads these two functions but not under safari,
> and when i try to output json with alert(json) i get nothing, can
> anyone lend me an extra set of eyes on this one please? my guess is on
> the function(transport, json){..} side of it since none of the docs
> reference calling it like this but its the only way it works under IE/
> FF
>
> Paul


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to