Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Server-side processing?

by frank1 (Scribe)
on Feb 14, 2024 at 12:07 UTC ( [id://11157689]=note: print w/replies, xml ) Need Help??


in reply to Re: Server-side processing?
in thread Server-side processing?

i have read some articles and saw some examples, this is what i also need to return data from perl backend as JSON and print out in html

Replies are listed 'Best First'.
Re^3: Server-side processing?
by marto (Cardinal) on Feb 14, 2024 at 12:12 UTC

    Are you saying you now know what you need to do?

      i dont know, i was just reading some article, to be able to handle multi records in datatable. and i found out that i need to do server side processing . and i came up with my script to find any help from anyone

      and most articles talking about returning data from database query to json data and return it to html. which is i dont know

        In the page you've shown, the JavaScript DataTable calls a perl script, that needs to return a JSON object rather than HTML. On success DataTables will render a grid populated with the results. For my use case (Mojolicious::Lite) this is as simple as the route returning the results via something like this:

        $c->render( json => $griddata );

        For your example you don't show a SSCCE, so unless you're using some framework you'll need to use a JSON module and return the results appropriately. DataTables perl modules I haven't used DataTables, Mojolicious::Plugin::DataTables. Looking at multiple previous threads, I think you'd get more benefit from taking the time to make sure your questions are more easily understood to avoid repetition. How do I post a question effectively?.

        You need a module that will convert your Perl data structure into JSON. See for example JSON. You do not "return it to HTML". Once you have the JSON data, you return that in response to the Ajax call.

        Hope this helps!


        The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11157689]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-05-21 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found