# Problem with "Build a Random Quote Machine" project

**URL:** <https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254>\
**Category:** General\
**Created:** [June 24, 2017, 8:36am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254 "2017-06-24T08:36:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yur375](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/yur375/32/72069_2.png) [@Yur375](https://forum.freecodecamp.org/u/Yur375)\
**Post date:** [June 24, 2017, 8:36am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/1 "2017-06-24T08:36:31Z")

</div>

Hi, guys. I’m need your help, because I stacked with my “Build a Random Quote Machine” project for a few days. I rewrote code so many times, and try some different APIs, but code still doesn’t work properly. Help me, please. Here’s the code:  
$(".btn-new").click(function(){  
$.getJSON(“[https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en&jsonp=parseQuote](https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en&jsonp=parseQuote)”, function parseQuote(quoteObj) {  
$("#quote").html(quoteObj.quoteText);  
$("#author").html(quoteObj.quoteAuthor);  
});  
});  
Project on Codepen:  
[https://codepen.io/yur375/pen/gRWVpj](https://codepen.io/yur375/pen/gRWVpj)

---

<div class="post-metadata">

**Author:** ![AlessioNovi](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@AlessioNovi](https://forum.freecodecamp.org/u/AlessioNovi)\
**Post date:** [June 24, 2017, 9:04am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/2 "2017-06-24T09:04:16Z")

</div>

Hi,

I had the same problem as you.

try to incorporate this line of code for your api request

“[https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?&lang=en](https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?&lang=en)”

this should get you going.

now you need to incorporate the the twitter button at least for completing the user stories

---

<div class="post-metadata">

**Author:** ![GummyGuppy](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/gummyguppy/32/302123_2.png) [@GummyGuppy](https://forum.freecodecamp.org/u/GummyGuppy)\
**Post date:** [June 24, 2017, 9:13am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/3 "2017-06-24T09:13:34Z")

</div>

Hi there!

It looks like you have one JSON object you’re trying to grab information from.

The .getJSON method’s callback function is an anonymous function (so get rid of the parseQuote name)

source: [http://api.jquery.com/jquery.getjson/](http://api.jquery.com/jquery.getjson/)

The .html() jQuery method accepts either no arguments, or a function. So I would look into that as well.

source: [http://api.jquery.com/html/](http://api.jquery.com/html/)

It looks like you’re really close though! Best of luck.

---

<div class="post-metadata">

**Author:** ![Yur375](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/yur375/32/72069_2.png) [@Yur375](https://forum.freecodecamp.org/u/Yur375)\
**Post date:** [June 24, 2017, 9:46am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/4 "2017-06-24T09:46:55Z")

</div>

> [@AlessioNovi](#):
>
> [https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?&lang=en](https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?&lang=en)

Hi! And thank you very much, it’s worked. I spent so many time trying to fix it. And your advice was very helpful. Thanks a lot.🙂

---

<div class="post-metadata">

**Author:** ![Yur375](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/yur375/32/72069_2.png) [@Yur375](https://forum.freecodecamp.org/u/Yur375)\
**Post date:** [June 24, 2017, 9:48am UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/5 "2017-06-24T09:48:32Z")

</div>

Hi. Thank you for a useful links, I’ll read this all to better understand the ajax.

---

<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:55pm UTC](https://forum.freecodecamp.org/t/problem-with-build-a-random-quote-machine-project/131254/6 "2021-01-17T20:55:25Z")

</div>

Closed on January 17, 2021, 8:55pm UTC


