RamiD has asked for the wisdom of the Perl Monks concerning the following question:

HI , I have a problem working with perl dancer passing hashref param to server into json stream like oboe.js (json stream) Here what I did in server and client

get '/test' => sub { my $jsonobj; $jsonobj='[{"name":"test","problem":"pass to oboe stream in the se +rver "}]'; debug $jsonobj; template 'test' => {passtoserver=>$jsonobj}; }; in the server side <!DOCTYPE html> <html> <head> <script src='/javascripts/3party/oboe-browser.min.js' type +="text/javascript"></script> </head> <body> <div style = "padding: 100px 100px 10px;"> <script> oboe('<%passtoserver%>' ).done(function( fullJson ){ alert(fullJson) }); </script> </div> </body> </html>
in the example I had an error in the server side, oboe-browser.min.js:1 GET http://localhost:3000/%7B%22name%22:%22test%22,%22problem%22:%22pass%20this%20to%20oboe.js%20in%20teh%20server%20side%20%22%7D 404 (Not Found) what I did wrong !! thanks Rami D.

Replies are listed 'Best First'.
Re: perl pass hashref param to server into json stream
by Anonymous Monk on Aug 03, 2016 at 21:26 UTC

    Why are you giving oboe() a json string?

    What docs are you reading?

      I am new to perl dancer and json stream parser , searched the web and I did not find any example of both (perl and json stream parser in the server) if you can help it would be great

        I am new to perl dancer and json stream parser , searched the web and I did not find any example of both (perl and json stream parser in the server) if you can help it would be great

        So

        Why are you giving oboe() a json string? Which oboe documentation tells you that oboe wants a json string?

        You will forever remain "new" if you don't answer questions