Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 4 - LI #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LiZhuang214
Copy link

No description provided.

Copy link
Member

@rossbernet rossbernet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are close!
Nice work, but see if you can get the mydata to get plotted by using the technique I describe in the review comments.

console.log('done?');
});
};
console.log(mydata);//????????not defined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// its essential to define mydata out of the scope of ajax function below
var mydata;
var getAndParseData = function() {
  bikedata=$.ajax(bikeCrashPhillyUrl)
  .done(function(bikedata){
     mydata=JSON.parse(bikedata);
    console.log(mydata);
    console.log('done?');
  });
  };
    console.log(mydata);//????????not defined```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see how I defined mydata outside of the ajax call?

This allows the results of the ajax call to reach outside the function and save the data out in a that global scope that will persist after the function is run.

Try this again. This comes close to resolving the issue for you, but then I ran it again, and I got this error:

image

So youll have to define myfilter as a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants