Re: [Cppcms-users] Instantiate JsonRPC with dynamic URL path
Brought to you by:
artyom-beilis
|
From: Lee E. <le...@el...> - 2014-07-22 03:24:24
|
You can still place static files at other urls (even other domain) and have
the html refer to them and use them.
If you absolutely need the js url to change you can serve static files from
cppcms app
בתאריך 21 ביול 2014 17:39, "CN" <cn...@fa...> כתב:
> Please pardon me for asking client question. I have no idea what else
> place I can ask for help.
>
> I prefer to place myscript.js as an external file than to in-line it in
> HTML page.
>
> The URL passed to JsonRPC is determined in run time. As a result,
> myscript.js can not be coded as below because "/run/time/url" is not
> static. It is volatile:
>
> var rpc=new JsonRPC('/run/time/url',['get'],[]);
> rpc.get.on_result=function(r){ alert(r); }
> rpc.get.on_error=function(e){ alert(e); }
>
> I also tried this variation:
>
> html:
> <body onload="init('<%= url %>');rpc.get()">
>
> myscript.js:
>
> function init(url){ rpc=new JsonRPC(url,['get'],[]); }
> rpc.get.on_result=function(r){ alert(r); } //variable "rpc" is unknown
> rpc.get.on_error=function(e){ alert(e); } //variable "rpc" is unknown
>
> However, my browser complains that variable "rpc" is unknown.
>
> Would someone please help me out?
>
> Regards,
> CN
>
> --
> http://www.fastmail.fm - A fast, anti-spam email service.
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
|