Can't run pen on local computer

This is my drawing site for Random Quote machine challenge: I exported the site completely, but on the local machine it stopped working, while on codepen everything works fine. What could be the problem? External scripts are loaded correctly. If I replace the code with a simple alert () call, everything works.

Codepen does a lot of work for you behind the scenes. Post your HTML file and Javascript file. If unsure how to do that, start a line with the key to the left of number 1 key, 3 times. Hit enter, paste your code, hit enter and put 3 `s again. Replace Xs with key next to the number one key.
your code

1 Like

It is just scratch, so for now it is very simple

<!DOCTYPE html>
   <html >
   <meta charset="UTF-8">
   <title>A Pen by  EvgeniyMuravev</title>
    <p id="quote"></p>
    <i id="author"></i>
    <p id="link"></p>
    <button id="getQuote" onclick="getQuote()">New Qoute</button>
    <script src=''></script>

   <script src="js/index.js"></script>



$(function() {
function getQuote(){
      type: 'POST',
      url: '//',
      dataType : 'jsonp',  
      data: { 

 function parseQuote(response)
			document.getElementById("quote").innerHTML = response.quoteText;
			document.getElementById("author").innerHTML = response.quoteAuthor;
      document.getElementById("link").innerHTML = "<a href='"+response.quoteLink+"'>"+response.quoteLink+"</a>";

Check this out and don’t forget script tags in the index.js file.

All files was generated by, so all tags are ok, but it doesn’t work

Look in the console:

Your problem is that you are using the URL:


This will not work on your local file system. When you have // and you load the file from your computer, the web browser will look on your computer for the file named "" (like it is an actual file named api.forismatic with a .com extension). You need to specify that you want the link to get data from an actual website:

If you put your code on a web server again, you will be fine with just the //

1 Like

AJAX code must be executed online (localhost or real host). What operating system are you using?

What makes you think that? I downloaded it, changed the link, and it all worked fine opening up the file in my browser. AJAX is the browser making the request. You don’t need a server for the browser to make a request.

1 Like

Great! Everything’s works fine, thanks to you!

1 Like

It was my mistake. I did not see the missing https://. You are correct.

1 Like