tag:help.lighthouseapp.com,2008-09-20:/discussions/api-developers/1727-trouble-getting-started-would-you-kindly-tell-me-what-is-wrong-with-this-jquery-ajax-requestLighthouse: Discussion 2013-12-11T01:14:50Ztag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T00:38:09Z2013-12-11T00:38:09ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>Is this code going to be public anywhere? Your token can be used
for all sorts of evil.</p></div>Tiger Teamtag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T00:39:52Z2013-12-11T00:39:52ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>No, it won't be public. I'm just making some simple scripts to
automate ticket tracking for some internal tools.</p></div>Shaun Reynoldstag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T00:42:27Z2013-12-11T00:42:27ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>I see a bunch of requests sending OPTIONS requests instead of
GET. Your ajax request isn't working...</p>
<p>site:77075 user:nil [302 Found] OPTIONS /projects.json action=
params={"method"=>:get, "paths"=>["projects.json"]}
format=*/* ip=76.14.71.239 location=<a href=
"http://owngroup.lighthouseapp.com/login">http://owngroup.lighthouseapp.com/login</a>
duration=5ms db=1ms</p></div>Tiger Teamtag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T01:02:46Z2013-12-11T01:02:46ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>I figured it out. jQuery was setting headers in such a way that
it was triggering a cross-site scripting preflight request.</p>
<p>setting a dataType of 'jsonp' fixed it...</p>
<pre>
<code>$.ajax({
headers: { 'X-LighthouseToken' : LightHouse.apiToken },
url: url,
type: 'GET',
dataType: "jsonp",
success: function( data, textStatus, jqXHR ) {
console.log('yippiee');
}
});</code>
</pre></div>Shaun Reynoldstag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T01:03:18Z2013-12-11T01:03:18ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>Thanks for your very prompt responses :)</p></div>Shaun Reynoldstag:help.lighthouseapp.com,2008-09-20:Comment/304829682013-12-11T01:14:49Z2013-12-11T01:14:49ZTrouble getting started: would you kindly tell me what is wrong with this jQuery ajax request?<div><p>no worries good luck getting it all integrated!</p></div>Tiger Team