# Trigger a jquery function on post load

**URL:** <https://meta.discourse.org/t/trigger-a-jquery-function-on-post-load/85003>\
**Category:** Development\
**Created:** [April 10, 2018, 6:23pm UTC](https://meta.discourse.org/t/trigger-a-jquery-function-on-post-load/85003 "2018-04-10T18:23:59Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [April 11, 2018, 5:37pm UTC](https://meta.discourse.org/t/trigger-a-jquery-function-on-post-load/85003/10 "2018-04-11T17:37:37Z")

</div>

> [@Olivier\_Lambert](#):
>
> the script fire before the users variable get registered in the window variable.

This line should give you all the info you need about the user.

[https://github.com/tshenry/discourse-trust-level-avatar-flair/blob/master/common/head\_tag.html#L7](https://github.com/tshenry/discourse-trust-level-avatar-flair/blob/master/common/head_tag.html#L7)

> [@Olivier\_Lambert](#):
>
> However, I need to run a GET request first.

Are you running this extra request for every poster in a topic?

If you store this info in a custom\_user\_field, and make put it in the `public_user_custom_fields` site setting they should be available there. (not sure about this, you will need to test. If they aren’t you can add those to the topic/post serializer in a plugin)

---

_[View the full topic](https://meta.discourse.org/t/trigger-a-jquery-function-on-post-load/85003)._
