Hi Denuwanthi,
This is not a UUF related issue, this is how DOM works. To fix register
listener to a higher node [1]. In the given sample they are using
'document', but as a best practice you should use the closest know parent,
eg: parent div of the zone you are rendering the fragment into.
For more info on how this works please read more on dom even model [2].


[1]
http://stackoverflow.com/questions/19371141/jquery-on-isnt-binding-click-events-to-dynamically-created-elements
[2] http://javascript.info/tutorial/bubbling-and-capturing

On Tue, Mar 14, 2017 at 2:02 PM, Denuwanthi De Silva <denuwan...@wso2.com>
wrote:

> Hi,
>
> I'm currently rendering a fragment inside a page using
> 'UUFClient.renderFragment' method.
> Then I display it in the page using "{{#defineZone}} helper.
>
> This fragment contains a button.
> When I click that button I need to do an ajax call to a micro service.
>
> I make the ajax call inside the front-end js of the current page.
> This seems not to be working, as the button is in the fragment.
>
> So, is it ok to define a front-end js in the fragment and do the ajax call
> from it, instead of the front-end js of the current page .?
>
>
> Thanks
>
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>



-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to