# Help with wikipedia viewer challenge

**URL:** <https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126>\
**Category:** General\
**Created:** [July 25, 2017, 7:53am UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126 "2017-07-25T07:53:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![attisammy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/attisammy/32/74178_2.png) [@attisammy](https://forum.freecodecamp.org/u/attisammy)\
**Post date:** [July 25, 2017, 7:53am UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126/1 "2017-07-25T07:53:04Z")

</div>

Hey Guys! I am having a bit of a challenge with my Wikpedia viewer. Cant get the API to work. Would appreciate any help and possible solutions. Thank you

Javascript Code:

$(document).ready(function(){  
//“[https://en.wikipedia.org/w/api.php?action=opensearch&search=&callback=?"](https://en.wikipedia.org/w/api.php?action=opensearch&search=&callback=?%22)  
$(”#search").click(function(){

```
var searchItem = $("#searchItem").val();

 $.ajax({
  url: "https://en.wikipedia.org/w/api.php",
  dataType: "json",
  data: {
    action: "opensearch",
    format: "json",
    origin: "*",
    search: searchItem,
    formatversion: "2", 
    success: function(data){
    console.log(data); 
    },
    error: function(errorMsg) {
     alert("Error");
    }

 }

```

});  
//Enter Keyboard click  
});

});

---

<div class="post-metadata">

**Author:** ![kevcomedia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevcomedia/32/125737_2.png) [@kevcomedia](https://forum.freecodecamp.org/u/kevcomedia)\
**Post date:** [July 25, 2017, 8:44am UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126/2 "2017-07-25T08:44:30Z")

</div>

The `success` and `error` functions shouldn’t be inside the `data` object.

---

<div class="post-metadata">

**Author:** ![attisammy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/attisammy/32/74178_2.png) [@attisammy](https://forum.freecodecamp.org/u/attisammy)\
**Post date:** [July 26, 2017, 3:37am UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126/4 "2017-07-26T03:37:26Z")

</div>

Thank you so much guys, but after making the changes API call is still not working and I keep getting this error logged on my Web Console (Firefox):

“An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing”

Dont understand what it means. Thanks again guys

---

<div class="post-metadata">

**Author:** ![attisammy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/attisammy/32/74178_2.png) [@attisammy](https://forum.freecodecamp.org/u/attisammy)\
**Post date:** [July 26, 2017, 5:18am UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126/6 "2017-07-26T05:18:05Z")

</div>

Thank you so much SkyC, returning API calls now. You have been extremely helpful, cant thank you enough. God bless you.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:47pm UTC](https://forum.freecodecamp.org/t/help-with-wikipedia-viewer-challenge/138126/7 "2021-01-17T20:47:25Z")

</div>


