A new day, a new question.
I was trying to load a json object while using Firebug and jQuerify to inject jQuery code into the website of the currently active tab. If you don’t know what I’m talking about, these are firefox add-ons. Firebug is a great debugging tool whereas jQuerify adds the jQuery library to any website if it’s not yet loaded.
Now some details to my recent problem. If I enter the URL into the browsers location field I get a proper json object back. If I send an XMLHttpRequest to the same URL the server responses with the status code 301 Moved Permanently. Has this issue to do with the Same Origin Policy (SOP) ?
If so I need a workaround because this URL will be the new API URL for some web apps.
Any suggestions what this could be?
Edit:
It wasn’t a SOP problem but I also had to face with such a problem later. The above described behaviour came from a missing / at the end of the URL. Entering such a URL into the location field the browser automatically add the tailing slash if it’s missing. After I found that out I wasn’t able to fetch the json from another domain. It’s been months that I’ve been coding jQuery a lot so I forgot one little but important information. The server has to send an additional header to allow other domains. More about this later in a seperate post.