# How to pass data to panel plugin's front end?

**URL:** <https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 8, 2019, 10:21am UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252 "2019-03-08T10:21:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hdodov](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hdodov/32/8171_2.png) [@hdodov](https://forum.getkirby.com/u/hdodov)\
**Post date:** [March 8, 2019, 10:21am UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252/1 "2019-03-08T10:21:20Z")

</div>

In Kirby 2, I was able to pass any data I wished to the front end of the panel with something like:

```auto
<script>
window.MyData = <?= kirby()->something() ?>;
</script>

```

and in my front end script, I would do:

```auto
console.log(window.MyData)

```

So how would I do something similar in K3? I thought of creating a route that outputs the data I needed and fetching it in the front end with AJAX, but that seems like a huge overkill.

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [March 8, 2019, 10:53am UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252/2 "2019-03-08T10:53:09Z")

</div>

> [@hdodov](#):
>
> \<script\> window.MyData = \<?= kirby()-\>something() ?\>; \</script\>

Try:

```auto
<?= $kirby->something() ?>

```

But what is `something()`? Can it be anything? But i’m not sure why the first one didn’t work for you.

---

<div class="post-metadata">

**Author:** ![hdodov](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hdodov/32/8171_2.png) [@hdodov](https://forum.getkirby.com/u/hdodov)\
**Post date:** [March 8, 2019, 10:59am UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252/3 "2019-03-08T10:59:04Z")

</div>

I put `something()` as a placeholder. It can be any data.

I can’t use what you’ve proposed because I need the data at the front end of my plugin. The plugin uses a [panel view](https://getkirby.com/docs/reference/plugins/extensions/panel-views). I need to pass some data to this panel view from the server. I.E. I need to pass server data to the Vue component.

---

<div class="post-metadata">

**Author:** ![moeli](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/moeli/32/8964_2.png) [@moeli](https://forum.getkirby.com/u/moeli)\
**Post date:** [March 8, 2019, 12:56pm UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252/4 "2019-03-08T12:56:43Z")

</div>

The panel is a pure Vue app. Instead of passing data you could fetch it in the views js part.

---

<div class="post-metadata">

**Author:** ![hdodov](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/hdodov/32/8171_2.png) [@hdodov](https://forum.getkirby.com/u/hdodov)\
**Post date:** [March 8, 2019, 2:36pm UTC](https://forum.getkirby.com/t/how-to-pass-data-to-panel-plugins-front-end/13252/5 "2019-03-08T14:36:18Z")

</div>

I see. I agree with you, but it would be pretty inefficient to fetch a single static value with AJAX. If you look at the source of the rendered panel page, you see:

```auto
<script>window.panel = {"url":"http://localhost/ikarov/panel","site":"http://localhost/ikarov","api":"http://localhost/ikarov/api","csrf":"9e1534bfa938023d64360efbfedb4ed29fa2bf7e1d41b71efc5d96d66c34d964","translation":"en","debug":true,"search":{"limit":10}}</script>

<script src="http://localhost/ikarov/media/panel/3d4b11f6ee2a89fd5ace87c910cee04b/js/plugins.js" defer></script>
<script src="http://localhost/ikarov/media/panel/3d4b11f6ee2a89fd5ace87c910cee04b/js/vendor.js" defer></script>
<script src="http://localhost/ikarov/media/plugins/index.js" defer></script>
<script src="http://localhost/ikarov/media/panel/3d4b11f6ee2a89fd5ace87c910cee04b/js/app.js" defer></script>

```

So the panel already uses this method to provide server data to the Vue app. Perhaps a feature could be implemented that allows you to add your own `<script>` tag. Or perhaps some key in the `Kirby::plugin` definition of the plugin where you can specify some values to be included in `window.panel` up top.
