ajax and javascript

27 Jun '16, 09:04 PM
8,318 Views
Forum Forum Starter - Level 1

Hi I have a problem hope someone can help me.

I have a javascript function (in the template ) that preload a field with directions (google maps api) my function is in body onload=myfunction.

When the page is ready my function works fine the problem is when i use a flow with ajax the event start and when the event over the fields are no longer preloaded with my function.

the same thing happen when a validation rule start my fields are fine but when the page is refresh(with ajax) it ignores my function is there any possible solution.

Thanks

 
x 1
Follow
Answer Answer at this question and get points!
Forum Expert - Level 8

Hi,

the best way to include JavaScript functions in the page is to use jQuery.

Here is a sample code

    jQuery( document ).ready( function( $ ) {
        //my logic
    });   

 

In this way you code should be executed also when AJAX events are fired.

   
x 0
No Forum Badges

Did you find a solution? Same problem

 

Thanks!

 
x 0
Answer at this question and get points!