Here is the link to my codepen project: https://codepen.io/mlestina/pen/OZpOQW?editors=1111
I am having trouble retrieving data from the Wiki API.
When I check the Contr-Shift-J readout, I see:
Loading failed for the <script> with source “https://en.wikipedia.org/w/api.php?action=opensearch&search=dsfds&callback=jQuery331010723807837372779_1525209741598&_=1525209741599”. index.html:1
An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing. OZpOQW
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://static.codepen.io/assets/telefon/bold/af889c53-1ee3-4868-8fdc-2b310d587b50-3-b7a87e0fbd213943fae0c0ef5985635dd43fa9c24876b2725127a13ccaf4ab6a.woff. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). (unknown)
downloadable font: download failed (font-family: "Telefon" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: https://static.codepen.io/assets/telefon/bold/af889c53-1ee3-4868-8fdc-2b310d587b50-3-b7a87e0fbd213943fae0c0ef5985635dd43fa9c24876b2725127a13ccaf4ab6a.woff unknown:1:24452
Loading failed for the <script> with source “https://en.wikipedia.org/w/api.php?action=opensearch&search=Hitler&callback=jQuery33109582690097080016_1525209907566&_=1525209907567”. index.html:1
This site appears to use a scroll-linked positioning effect. This may not work well with asynchronous panning; see https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects for further details and to join the discussion on related tools and features! OZpOQW
The HTML code snippet is:
<body>
<form>
<input type="text" name="a" id="a"><br>
<button onclick="passToJ()">Search</button>
</form>
</body>
And here is the Javascript function:
function passToJ() {
var searchTerm = document.getElementById('a').value;
console.log("inside function, searchTerm is: ", searchTerm, " and x is: ", x);
var wikiLink = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchTerm + "&callback=?";
$.ajax({
url: wikiLink,
dataType: "jsonp",
type: "GET",
success: function(data) {
console.log(data);
},
error: function() {
console.log('error occurred');
}
})};