1
2
3
4
5
6
7
8
9
var datainput = JSON.stringify({"test":"orcl"});
$http.post('http://localhost/perltest/perltest.pl/post', datainput)
.success(function(data, status, headers, config) {
console.log("post geschickt");
console.log(headers());
console.log(data);
console.log("data back: " + JSON.stringify(data));
alert(JSON.stringify(data));
})
1
2
3
4
5
6
7
8
post '/post' => sub {
my $self = shift;
my $json = $self->req->json;
print header(-type => "text/html");
print Dumper($json->{test});
};
app->start;
post '/post' => sub {
$http.post('http://localhost/perltest/perltest.pl/post', datainput)
#$self->render(json => {Anwort => "Sie haben Post"});
1
2
3
my $self = shift;
my $json = $self->req->json;
$self->render( text => $json->{test} );
#$self->render(json => {Anwort => "Sie haben Post"});
$self->render( text => $json->{test} );
$self->render( text => $json->{test} );
$self->render( [b]json [/b]=> $json->{test} );
$self->render( text => Dumper( Dumper($json->{test}) ) );
my $json = JSON->new();