# Debugging jscript in site configuration

**URL:** <https://forums.plex.tv/t/debugging-jscript-in-site-configuration/8469>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [March 23, 2011, 8:07pm UTC](https://forums.plex.tv/t/debugging-jscript-in-site-configuration/8469 "2011-03-23T20:07:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IanDBird](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/iandbird/32/85993_2.png) [@IanDBird](https://forums.plex.tv/u/IanDBird)\
**Post date:** [March 23, 2011, 8:07pm UTC](https://forums.plex.tv/t/debugging-jscript-in-site-configuration/8469/1 "2011-03-23T20:07:47Z")

</div>

I’m trying to write some javascript for a Site Configuration file which will authenticate before redirecting back to the original url. I think that it’s nearly there but struggling to actually get it working! Does anyone know of a good way to debug this? I’ve tried using Google Javascript Console to see if it works. However, the jQuery object cant be used directly in the console. I’m guessing I need to use some other syntax to use jQuery directly. Anyone have any suggestions?  
  
  
  
Here’s my site config, in case you can spot something that i’m doing wrong:

```auto

<br />
    <!-- Loading --><br />
	<state name="loading"><br />
		<event><br />
        	<condition><br />
            	<frameLoaded /><br />
			</condition><br />
			<br />
        	<action><br />
        		<run script="function logMeIn(){login.userName.value='${username}';login.password.value='${password}';login.nextUrl.value='/page/playLiveTv.do?epgChannelId=1301';login.onsubmit();}"/><br />
        		<run script="var result=document.cookie.match(/skySSO=(.+?);/g);if(result==undefined){jQuery.load('https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do',function(){logMeIn();});}"/><br />
			<pause time="5000" /><br />
			<goto state="playing" /><br />
        	</action><br />
    	</event><br />
	</state><br />
	<br />
	<!-- Playing --><br />
	<state name="playing"><br />
		<event><br />
        	<condition><br />
            	<frameLoaded /><br />
			</condition><br />
			<br />
        	<action><br />
        		<!-- Do Nothing --><br />
        	</action><br />
    	</event><br />
	</state><br />

```

  
  
Is it correct to use 'jQuery.load'... with a callback function to programmatically submit the login page?  
  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![IanDBird](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/iandbird/32/85993_2.png) [@IanDBird](https://forums.plex.tv/u/IanDBird)\
**Post date:** [March 24, 2011, 8:46pm UTC](https://forums.plex.tv/t/debugging-jscript-in-site-configuration/8469/2 "2011-03-24T20:46:18Z")

</div>

No one? Is there any way to see the output from the javascript in the log files? I’m struggling to debug how far the script is getting and whats going wrong.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 9:03pm UTC](https://forums.plex.tv/t/debugging-jscript-in-site-configuration/8469/3 "2019-12-20T21:03:28Z")

</div>

Closed on December 20, 2019, 9:03pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
