{"id":3696386,"date":"2013-04-26T13:27:13","date_gmt":"2013-04-26T13:27:13","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/how-to-enqueue-some-javascript-source\/"},"modified":"2016-08-21T00:30:58","modified_gmt":"2016-08-21T00:30:58","slug":"how-to-enqueue-some-javascript-source","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/how-to-enqueue-some-javascript-source\/","title":{"rendered":"How to enqueue some javascript source"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I need my plugin to generate two things &#8211; once on the page:<\/p>\n<p>1) Using wp_enqueue_script() &#8211; this is done<br \/>\n&lt;script type=&#8221;text\/javascript&#8221; src=&#8221;https:\/\/&lt;url&gt;.js&#8221;&gt;&lt;\/script&gt;<\/p>\n<p>2) What can I use to generate a piece of javascript initialization code that should only appear once on the page<\/p>\n<p>eg.<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\nritc.initialize(&#8216;63864593a4153879&#8217;);<br \/>\n&lt;\/script&gt;<\/p>\n<p>Is there anything like wp_enqueue_script() but which takes a string instead of a url?<\/p>\n<p>Thanks in anticipation.<\/p>\n<p>Colin G<\/p>\n","protected":false},"template":"","class_list":["post-3696386","topic","type-topic","status-closed","hentry","topic-tag-initialization","topic-tag-wp_enqueue_script"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3696386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3696386\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3696386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}