On 27/04/07, nihaopaul <[EMAIL PROTECTED]> wrote:
>
> On Apr 27, 2:21 am, tobie <[EMAIL PROTECTED]> wrote:
> > You'd be safer outputting your JSON in the responseText rather than in
> > a header.
>
>
> Tobie, my new best friend!
>
> worked like a charm in safari and just took one line in the js
> function:
>
> new Ajax.Request('/include/dynamic.php?Login', {
> method: 'get',
> requestHeaders: {Accept: 'application/json'},
> evalScripts: true,
> onSuccess: function(transport, json){
> //Tobie rocks for this next line for safari support
> json = json || transport.responseText.evalJSON();
> 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])
> }
> }
> });
>
> also i printed the content instead of including it in the header:
> //php class function
> private function output($array) {
> $output = json_encode( $array );
> header('Content-type: application/json');
> print($output);
> }
private function output($array) {
header('Content-type: application/json');
echo json_encode( $array );
}
Same but different.
>
> paul
>
>
> >
>
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---