accessing wikipedia api works in paw, curl code paw generates. paw jquery code fails, however, generating cors error.
// api (post https://en.wikipedia.org/w/api.php) jquery.ajax({ url: "https://en.wikipedia.org/w/api.php?" + jquery.param({ "action": "query", "list": "search", "srsearch": "feynman", "format": "json", "srlimit": "10", }), type: "post", contenttype: "application/json", data: json.stringify({ }) }) .done(function(data, textstatus, jqxhr) { console.log("http request succeeded: " + jqxhr.status); console.log(data); }) .fail(function(jqxhr, textstatus, errorthrown) { console.log("http request failed"); }) .always(function() { /* ... */ }); adding datatype: "jsonp", before type: "post" seems work. reasonable paw recognize problem , add whatever code appropriate? main motivation in purchasing paw hope if api call worked in paw, jquery code work well. thanks!
Comments
Post a Comment