Re: [Cppcms-users] Interface with javascript
Brought to you by:
artyom-beilis
From: jupiter <jup...@gm...> - 2017-07-17 11:16:12
|
Thanks Nazim for the kind advice, appreciate your helps. Kind regards, - j On Sat, Jul 15, 2017 at 10:36 PM, Nazım Can Bedir < naz...@ne...> wrote: > Hi, > > In such cases, I usually prefer to use technique which is also central to > Apache's Tapestry project. Basic structure is follows: > > - Boilerplate web page is generated by CppCMS as usual. > - Boilerplate web page is using require.js. > - On page load, require.js is loading web application's entry point. > - From the entry point, my own Javascript module do following: > - Make an Ajax requests to web app via JSON-RPC. > - On the server side, application is responding to requests with > cppcms::rpc::json_rpc_server. > - Javascript handles the server's response and apply changes. > - In my case, changes are either loading additional require.js > modules, or changing already existing DOM elements and their content on the > page. > - For things like user notification, I prefer to employ Server-Side > Events; where initial registration for the events are performed from the > Javascript module loaded by require.js. > > For JSON-RPC, please see http://cppcms.com/wikipp/en/ > page/cppcms_1x_chat_json_rpc. For Server-Side Events, please see > http://blog.cppcms.com/post/107. > > Out of box, CppCMS doesn't provide any way to glue browser events and DOM > to C++ objects. If you do not already know about, I highly suggest to take > a quick look at tapestry.apache.org for getting an idea about how deep > the rabbit hole may be :) > > Hope helps. > > Regards, > Nazim Can. > > On 15/07/17 15:23, jupiter wrote: > > Hi, > > I am still learning the structure of the cppcms, most of examples and > tutorials are calling cppcms generate html page. One thing I am not clear > is how to make an interface between C++ and javascript with AJAX > capability, the C++ feeds json to javascript which renders ajax style web > page. Appreciate any advice. > > Thank you, > > Kind regards, > > - j > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Cppcms-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |