Jump to content

AdminProductsExtra : preload JS


gytske

Recommended Posts

Hello,

 

 

I currently have an extra tab in Edit Product page :

hook displayAdminProductsExtra
hook actionProductUpdate

Tab works fine, except for the fact that it is loaded via Ajax. This is causing some complications for me.Basically I need a little extra JS in my tab (it has some input forms). 

 

Initially I was putting that JS inline together with HTML (I used <script>). This was because I need to pass some variable to JS in order it to work. My problem is that when a tab is retrieved via Ajax, JS code might not be evaluated, because it wansnt there on document load. It works on chrome but Im afraid that it wouldnt work on other browsers.

 

Some other options I have considered : 

- add JS file via displayBackOfficeHeader, but I cant do that since I need to emmbed some variables in JS

- preload tab if such function exists in PS

- stick with the way it is now (code retrieved from ajax is auto evaluated by chrome?). The coe is very hard to find since its not in DOM nor in file. It is in some VM local chrome variable.

 

 

Any tips?

Edited by gytske (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...