madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[ljcom] r12001: LJSUP-12148: JSON-RPC

Committer: sbelyaev
LJSUP-12148: JSON-RPC
U   trunk/cgi-bin/LJ/Response/JSON.pm
Modified: trunk/cgi-bin/LJ/Response/JSON.pm
===================================================================
--- trunk/cgi-bin/LJ/Response/JSON.pm	2012-05-24 07:34:46 UTC (rev 12000)
+++ trunk/cgi-bin/LJ/Response/JSON.pm	2012-05-24 08:29:57 UTC (rev 12001)
@@ -5,7 +5,7 @@
 use LJ::JSON;
 
 use base qw( LJ::Response );
-__PACKAGE__->mk_accessors( qw( data ) );
+__PACKAGE__->mk_accessors( qw( data callback ) );
 
 sub output {
     my ($self) = @_;
@@ -17,7 +17,11 @@
     if ($self->data) {
         LJ::Request->content_type('application/json; charset=utf-8');
         my $output = LJ::JSON->to_json( $self->data );
-        LJ::Request->print($output);
+        if ($self->callback) {
+            LJ::Request->print($self->callback . "($output)");
+        } else {
+            LJ::Request->print($output);
+        }
     }
 }
 

Tags: ljcom, madeon, pm, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments