On 3 Sep 2014, at 07:33, Kristian Kankainen <kristian@eki.ee> wrote:

The code I ended up with [..]

$.ajax( {
    'url': 'https://en.wikipedia.org/w/api.php',
    'data': {
        'action': 'query',
        'meta':   'userinfo',
        'format': 'json',
        'origin': location.window // depends on whether HTTP Origin header is sent or not
         

There is no such thing as location.window, this silently yields the undefined value in javascript.

I think you're looking for the global variable 'location' and one of its properties (perhaps "href" or "host")

https://developer.mozilla.org/en-US/docs/Web/API/Location#Properties

-- Krinkle