• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

Popup plugin : how to pass variables using jQuery ?

ImagesGuru

Chevereto Member
Hello,

For a developpement I am working on, I can't pass properties using data-xxx using <script> . I am forced to use a JS include system that does not pass properties but only calls the JS script. It's something like that :

Code:
{% INCLUDEJS './js/pup.js' %}

So I try to pass the properties using a div element :
Code:
<div id="images-guru" class="hidden" data-url="https://images.guru/upload" data-vendor="default" data-sibling=".message-box"></div>

And I try to recover the properties using jQuery in the JS :
Code:
var data = $('#images-guru').data();
console.log(data);

The console of my browser indicates that the variables to the javascript, but I do not know how to exploit them after :

@Rodolfo can you bring me a solution?
A big thank-you.
Jack
 
@ImagesGuru I sent you a PM asking something, but it sems you didn't care to reply to it. Please check into it.

Also @Rodolfo does not work on custom things, so if you need help others on here who can help will reply instead of author of script.
 
I am not asking @Rodolfo to develop something custom for me but just to tell me on what lines of the js to focus on.

@JakeSully I have read your pm today. I will give you my ext in the next days. Is not that simple, I have a specific sql table to endle that.
 
By design, pup.js is inside a closure so you can't access to any of its members. You will need to create your own pup, which is not that hard as you have the source already: https://demo.chevereto.com/sdk/pup.dev.js

So you have to change this:
JavaScript:
(function() {})()

To (something like) this:
JavaScript:
var PUP = {actual code};
...
PUP.prepare();
 
Hello @Rodolfo,

Thanks for reply.
Actualy all the code is between {}.

Do I have to do :

Code:
var PUP = function();
PUP(the actual code);

or

Code:
var PUP = function();
PUP() {the actual code};

or something else ?
 
JavaScript:
var PUP = {the actual code};
...
PUP.prepare();
 
I have done this afternood, is that ok or function is not needed ?

Code:
var PUP = function () {the actual code};
PUP();

Thanks
 
I never gave you usable code, "something like this" doesn't mean copy/paste, it means "you are looking for a result like this" and I assumed that you knew about JS.

Here, this is the usable code: https://pastebin.com/KyBh4cFJ
 
Back
Top