Random Quote Machine Secure HTTP Request Error

Random Quote Machine Secure HTTP Request Error
0

#1

Hi everybody!

I’ve spent about a week on this project and, as a result, am getting rather fed up with it. No matter what I do, I seem to fail the challenge - returning an error about HTTP vs HTTPS (which I must use because I’m requesting the info from an https site).

I’ve experimented with a variety of different options and finally settled upon using jQuery because it’s so easy and the site I’m building is very small.

The console.log() after the function is what reveals, rather than a quote, a URL error. Can anyone suggest anything? I haven’t been able to find an unpaid, secure API to use for this project.


#2

If you are using JavaScript you must supply an additional parameter called callback and give it the name of a function to pass the quote JSON to after it is loaded. See above for greater detail on that JSON object. The finished path would look like this:

?callback=my_function```

 Maybe it's because is missing the callback.

#3

Okay, I’m with you - but I’m really not sure how to include that (the top line is just the api url… I’m trying to put it into jQuery syntax and it hates the ?callback). Let me have a look around the web and see what I can find. I hope you’re right!


#4

^ the example I’m working from. Not sure which part of that represents callback.


#5

The reason the example dosnt need a callback argument is because its not getting the json file from another source. just add this to your link as an argument. callback=?

It will look something like this. "http://YourApiStuffHere.com/api/moreStuff.json&callback=?"
Note the &callback=? part.


#6

Hi :slight_smile:

Is easier using codepen ¿can you make a pen (in codepen)?


#7

I think this is it!

Thanks!!!


#8

k so that’s not all. i’m checking this method of writing it out:


#9

this is the resource i’ve found: http://learn.jquery.com/ajax/jquery-ajax-methods/