diff options
Diffstat (limited to 'cgi-bin')
| -rwxr-xr-x | cgi-bin/view | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cgi-bin/view b/cgi-bin/view index 526d268..3994117 100755 --- a/cgi-bin/view +++ b/cgi-bin/view @@ -53,6 +53,7 @@ sub main{ $params->{$key} = $value; } + my $callback = $params->{'callback'} || undef unless(defined $params->{f}){ not_specified_error("f"); @@ -90,11 +91,23 @@ sub main{ $res = mysql_retrieve('select shaders.* from shader_ids cross join shaders on shader_ids.id = shaders.shader_id'); } default { - print $json->pretty->encode ({ ERROR => "Function parameter f improperly defined"}); + if (defined $callback) { + print $callback + "("; + print $json->pretty->encode ({ ERROR => "Function parameter f improperly defined"}); + print ")"; + } + else { + print $json->pretty->encode ({ ERROR => "Function parameter f improperly defined"}); + } exit(1); }; } - print $res; + if (defined $callback) { + print $callback + "(" + $res + ")"; + } + else { + print $res; + } } main(); exit(0); |
