You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "Robert G." <ga...@mercon24.de> on 2012/04/15 22:22:58 UTC

include / render ftl file or screen in a java script file

Hey, 

Im doing an Ajax database manipulation. After Ajax succeed I want to replace
a div-container (referenced with its ID) with the content of an ftl file.
THe background is,that I want to update the data in the div-container.

I couldnt get it run with screens.render(../xy.ftl)

I tried it with the .load method (jquery) like that:

$(#div-container-ID).load(../xy.ftl), but it does not work. WIth above named
rendering it had not worked either.

Do anyone has an idea? I do this to avoid a complete site-reload.

--
View this message in context: http://ofbiz.135035.n4.nabble.com/include-render-ftl-file-or-screen-in-a-java-script-file-tp4559817p4559817.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: include / render ftl file or screen in a java script file

Posted by Rajbir Saini <ra...@yahoo.com>.
Excellent. :-)

On Monday 16 April 2012 08:14 AM, Robert G. wrote:
> just tested, works perfectly!
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/include-render-ftl-file-or-screen-in-a-java-script-file-tp4559817p4560420.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Re: include / render ftl file or screen in a java script file

Posted by "Robert G." <ga...@mercon24.de>.
just tested, works perfectly!

--
View this message in context: http://ofbiz.135035.n4.nabble.com/include-render-ftl-file-or-screen-in-a-java-script-file-tp4559817p4560420.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: include / render ftl file or screen in a java script file

Posted by "Robert G." <ga...@mercon24.de>.
wonderful!!! Thanks :) and thanks for the declaration concerning the
technologies!

Greetings

Robert

--
View this message in context: http://ofbiz.135035.n4.nabble.com/include-render-ftl-file-or-screen-in-a-java-script-file-tp4559817p4560357.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: include / render ftl file or screen in a java script file

Posted by Rajbir Saini <ra...@yahoo.com>.
Robert,

You cant load a ftl file like this. JavaScript is a client side 
technology and Freemarker runs on server side. What you need inside your 
JQuery is  HTML fragment and therefore to get the contents of an HTML 
file, create a request map in controller, pass it to the view map, and 
then the screen widget. Within your screen, include the FTL file. This 
is same as your calls without Ajax. Only difference would be, do not 
include the decorator in your Ajax screen as it will show the complete page.

One you receive the response in your JQuery success callback, replace 
the contents within you DIV with the contents received form server using 
something like $(#your div id).html(data).

Thanks,

Raj

On Monday 16 April 2012 01:52 AM, Robert G. wrote:
> Hey,
>
> Im doing an Ajax database manipulation. After Ajax succeed I want to replace
> a div-container (referenced with its ID) with the content of an ftl file.
> THe background is,that I want to update the data in the div-container.
>
> I couldnt get it run with screens.render(../xy.ftl)
>
> I tried it with the .load method (jquery) like that:
>
> $(#div-container-ID).load(../xy.ftl), but it does not work. WIth above named
> rendering it had not worked either.
>
> Do anyone has an idea? I do this to avoid a complete site-reload.
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/include-render-ftl-file-or-screen-in-a-java-script-file-tp4559817p4559817.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>