# Modernizing inline script tags for templates & JS API

**URL:** https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482
**Category:** Development
**Tags:** dev-news
**Created:** [May 19, 2025, 9:55am UTC](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482 "2025-05-19T09:55:17Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [July 14, 2025, 4:35am UTC](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482/6 "2025-07-14T04:35:20Z")

</div>

Almost, but not quite. You’d want to remove the script tags, and change the imports to something like:

```js
import { ajax } from "discourse/lib/ajax";

```

Then, paste all this in the JS tab, **inside** :

> [@david](#):
>
> ```js
> export default apiInitializer((api) => {
> // Your code here
> });
> 
> ```

---

_[View the full topic](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482)._
