you should use both, the dataType: 'jsonp' on the ajax config and the format=json on the url
On Tue, Sep 9, 2014 at 6:00 AM, mediawiki-api-request@lists.wikimedia.org wrote:
Send Mediawiki-api mailing list submissions to mediawiki-api@lists.wikimedia.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.wikimedia.org/mailman/listinfo/mediawiki-api or, via email, send a message with subject or body 'help' to mediawiki-api-request@lists.wikimedia.org
You can reach the person managing the list at mediawiki-api-owner@lists.wikimedia.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Mediawiki-api digest..."
Today's Topics:
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Kristian Kankainen)
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Legoktm)
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Bartosz Dziewoński)
Message: 1 Date: Mon, 8 Sep 2014 10:34:01 -0700 From: jim andrews jim@vispo.com To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 5CF6D333-BDF3-4952-B927-F164981F563C@vispo.com Content-Type: text/plain; charset=windows-1252
I read the recent thread on cross-domain AJAX problems with Wikipedia’s API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed at [1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from your own server rather than from a webpage. If you are going to be querying from a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Message: 2 Date: Tue, 09 Sep 2014 07:52:44 +0300 From: Kristian Kankainen kristian@eki.ee To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 540E879C.2090503@eki.ee Content-Type: text/plain; charset=UTF-8; format=flowed
Hello!
I got my queries working with the following code. Try removing your callback parameter from the url and try this:
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
Kristian K
08.09.2014 20:34, jim andrews kirjutas:
I read the recent thread on cross-domain AJAX problems with Wikipedia’s
API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load
https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is
ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed at [1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from
your
own server rather than from a webpage. If you are going to be querying
from
a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 3 Date: Tue, 9 Sep 2014 00:10:47 -0700 From: jim andrews jim@vispo.com To: MediaWiki API announcements & discussion mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: FDC654BC-8CE3-4F20-8144-C0CD56A421DD@vispo.com Content-Type: text/plain; charset=windows-1252
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Resource interpreted as Script but transferred with MIME type text/html: " https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&g...". jquery-1.11.0.min.js:4 Refused to execute script from ' https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&g...' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I am getting this error both locally and after I upload to my real server. Please advise.
ja
On Sep 8, 2014, at 9:52 PM, Kristian Kankainen kristian@eki.ee wrote:
Hello!
I got my queries working with the following code. Try removing your
callback parameter from the url and try this:
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
Kristian K
08.09.2014 20:34, jim andrews kirjutas:
I read the recent thread on cross-domain AJAX problems with Wikipedia’s
API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load
https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is
ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed
at
[1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from
your
own server rather than from a webpage. If you are going to be querying
from
a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 4 Date: Tue, 09 Sep 2014 01:14:14 -0700 From: Legoktm legoktm.wikipedia@gmail.com To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 540EB6D6.7040302@gmail.com Content-Type: text/plain; charset=UTF-8
On 9/9/14, 12:10 AM, jim andrews wrote:
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the
format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Actually you should pass format=json if you want JSON to be returned. If no format parameter is specified, the API defaults to "xmlfm", which is an HTML representation of the XML format. See https://www.mediawiki.org/wiki/API:Data_formats#Output for some more details.
-- Legoktm
Message: 5 Date: Tue, 9 Sep 2014 01:38:34 -0700 From: jim andrews jim@vispo.com To: MediaWiki API announcements & discussion mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 4F588DB3-91D8-44C0-90D5-4ABA17170E7C@vispo.com Content-Type: text/plain; charset=windows-1252
Hi Legoktm,
Did you note
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
I presume the ‘dataType’:’jsonp’ inserts some parameter in the URL that sets the format. To jsonp.
ja
On Sep 9, 2014, at 1:14 AM, Legoktm legoktm.wikipedia@gmail.com wrote:
On 9/9/14, 12:10 AM, jim andrews wrote:
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the
format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Actually you should pass format=json if you want JSON to be returned. If no format parameter is specified, the API defaults to "xmlfm", which is an HTML representation of the XML format. See https://www.mediawiki.org/wiki/API:Data_formats#Output for some more details.
-- Legoktm
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 6 Date: Tue, 9 Sep 2014 10:56:20 +0200 From: Bartosz Dziewoński matma.rex@gmail.com To: "MediaWiki API announcements & discussion" mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: <CAA-yUx1k+_0750XL= PA0eBBvCTSnY6MzwLJrFCxg2y4J8snHSw@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
It doesn't.
-- -- Matma Rex
Thanks very much. I am now getting the information returned to me.
Do you know if there are any plans to include an article summary in the list=geosearch results? That would be terrific. I’ve been using geonames.org and it returns a brief 300 character article summary which seems to be the first 300 characters of the Wikipedia articles. This is very useful in search results, of course. The user can use that information to decide which of the several links to click. The title alone is often rather mysterious.
Thanks, ja http://vispo.com
On Sep 9, 2014, at 6:53 AM, Mauricio Déleon mdeleon@xyznetworkinc.com wrote:
you should use both, the dataType: 'jsonp' on the ajax config and the format=json on the url
On Tue, Sep 9, 2014 at 6:00 AM, mediawiki-api-request@lists.wikimedia.org wrote: Send Mediawiki-api mailing list submissions to mediawiki-api@lists.wikimedia.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.wikimedia.org/mailman/listinfo/mediawiki-api or, via email, send a message with subject or body 'help' to mediawiki-api-request@lists.wikimedia.org
You can reach the person managing the list at mediawiki-api-owner@lists.wikimedia.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Mediawiki-api digest..."
Today's Topics:
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Kristian Kankainen)
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Legoktm)
- Re: Cross-domain AJAX problems with Wikipedia's API (jim andrews)
- Re: Cross-domain AJAX problems with Wikipedia's API (Bartosz Dziewoński)
Message: 1 Date: Mon, 8 Sep 2014 10:34:01 -0700 From: jim andrews jim@vispo.com To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 5CF6D333-BDF3-4952-B927-F164981F563C@vispo.com Content-Type: text/plain; charset=windows-1252
I read the recent thread on cross-domain AJAX problems with Wikipedia’s API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed at [1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from your own server rather than from a webpage. If you are going to be querying from a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Message: 2 Date: Tue, 09 Sep 2014 07:52:44 +0300 From: Kristian Kankainen kristian@eki.ee To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 540E879C.2090503@eki.ee Content-Type: text/plain; charset=UTF-8; format=flowed
Hello!
I got my queries working with the following code. Try removing your callback parameter from the url and try this:
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
Kristian K
08.09.2014 20:34, jim andrews kirjutas:
I read the recent thread on cross-domain AJAX problems with Wikipedia’s API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed at [1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from your own server rather than from a webpage. If you are going to be querying from a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 3 Date: Tue, 9 Sep 2014 00:10:47 -0700 From: jim andrews jim@vispo.com To: MediaWiki API announcements & discussion mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: FDC654BC-8CE3-4F20-8144-C0CD56A421DD@vispo.com Content-Type: text/plain; charset=windows-1252
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Resource interpreted as Script but transferred with MIME type text/html: "https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&g...". jquery-1.11.0.min.js:4 Refused to execute script from 'https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&g...' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I am getting this error both locally and after I upload to my real server. Please advise.
ja
On Sep 8, 2014, at 9:52 PM, Kristian Kankainen kristian@eki.ee wrote:
Hello!
I got my queries working with the following code. Try removing your callback parameter from the url and try this:
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
Kristian K
08.09.2014 20:34, jim andrews kirjutas:
I read the recent thread on cross-domain AJAX problems with Wikipedia’s API but I’m still having problems. I’m getting the following error:
XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&list=recentchanges&f.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vispo.com' is therefore not allowed access.
That results after I make the following call: $.ajax({url:url, success:ajaxSuccess, error:ajaxError});
where url is the above url, ajaxSuccess is a function, and so is ajaxError. I also wrote an accessible function fooblah but it doesn’t get called.
Please advise.
Brad wrote:
There is a whitelist, stored in the configuration variable $wgCrossSiteAJAXdomains in CommonSettings.php. This file can be viewed at [1], or in revision control at [2].
You can query anonymously using JSONP (e.g. [3]), or by querying from your own server rather than from a webpage. If you are going to be querying from a webpage, do review the API Etiquette page.[4]
[2]:
https://git.wikimedia.org/blob/operations%2Fmediawiki-config.git/master/wmf-...
[3]:
https://et.wikipedia.org/w/api.php?action=query&list=recentchanges&f...
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 4 Date: Tue, 09 Sep 2014 01:14:14 -0700 From: Legoktm legoktm.wikipedia@gmail.com To: mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 540EB6D6.7040302@gmail.com Content-Type: text/plain; charset=UTF-8
On 9/9/14, 12:10 AM, jim andrews wrote:
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Actually you should pass format=json if you want JSON to be returned. If no format parameter is specified, the API defaults to "xmlfm", which is an HTML representation of the XML format. See https://www.mediawiki.org/wiki/API:Data_formats#Output for some more details.
-- Legoktm
Message: 5 Date: Tue, 9 Sep 2014 01:38:34 -0700 From: jim andrews jim@vispo.com To: MediaWiki API announcements & discussion mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: 4F588DB3-91D8-44C0-90D5-4ABA17170E7C@vispo.com Content-Type: text/plain; charset=windows-1252
Hi Legoktm,
Did you note
$.ajax({ 'url': url, 'dataType': 'jsonp', 'cache': true, 'success': ajaxSuccess, 'error': ajaxError });
I presume the ‘dataType’:’jsonp’ inserts some parameter in the URL that sets the format. To jsonp.
ja
On Sep 9, 2014, at 1:14 AM, Legoktm legoktm.wikipedia@gmail.com wrote:
On 9/9/14, 12:10 AM, jim andrews wrote:
Hi Kristian,
Thanks for your help. I have removed the callback parameter (and the format=jsonfm) from the below url and have also changed the $.ajax call as you advise. Consequently, I am no longer getting the error I previously was. However, I am getting the below error:
Actually you should pass format=json if you want JSON to be returned. If no format parameter is specified, the API defaults to "xmlfm", which is an HTML representation of the XML format. See https://www.mediawiki.org/wiki/API:Data_formats#Output for some more details.
-- Legoktm
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Message: 6 Date: Tue, 9 Sep 2014 10:56:20 +0200 From: Bartosz Dziewoński matma.rex@gmail.com To: "MediaWiki API announcements & discussion" mediawiki-api@lists.wikimedia.org Subject: Re: [Mediawiki-api] Cross-domain AJAX problems with Wikipedia's API Message-ID: CAA-yUx1k+_0750XL=PA0eBBvCTSnY6MzwLJrFCxg2y4J8snHSw@mail.gmail.com Content-Type: text/plain; charset="utf-8"
It doesn't.
-- -- Matma Rex
What are the units of the below geosearch dist values? I presume they’re meters but the docs don’t say.
<?xml version="1.0"?> <api> <query> <geosearch> <gs pageid="286442" ns="0" title="Wikimedia Foundation" lat="37.787" lon="-122.4" dist="0.3" primary="" /> <gs pageid="283855" ns="0" title="Chinatown, San Francisco" lat="37.7947" lon="-122.407" dist="1087.3" primary="" /> <gs pageid="167267" ns="0" title="City Lights Bookstore" lat="37.7976" lon="-122.407" dist="1331" primary="" /> </geosearch> </query> </api>
Meters.
On Tue, Sep 9, 2014 at 2:49 PM, jim andrews jim@vispo.com wrote:
What are the units of the below geosearch dist values? I presume they’re meters but the docs don’t say.
<?xml version="1.0"?>
<api> <query> <geosearch> <gs pageid="286442" ns="0" title="Wikimedia Foundation" lat="37.787" lon="-122.4" dist="0.3" primary="" /> <gs pageid="283855" ns="0" title="Chinatown, San Francisco" lat="37.7947" lon="-122.407" dist="1087.3" primary="" /> <gs pageid="167267" ns="0" title="City Lights Bookstore" lat="37.7976" lon="-122.407" dist="1331" primary="" /> </geosearch> </query> </api> _______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org