How do I a get SPECIFIC string from webpage and then use it in my own JavaScript code?

So basically, I need to get a SPECIFIC number from a website’s page source via Google Chrome and then use that number in my own js code. The number from the website is not from it’s HTML, but from one of it’s scripts. There are some pictures below to help you better understand.

View image here, because I don’t have enough ‘reputation points’…

As you can see in the picutre circled in red, that is the number I want to take. It changes everytime the page reloads so I need a script (if possible) that will reload the page, find and take that number (it will change everytime it reloads), and then use it in my own JavaScript function as a variable or something.

The url in Google Chrome is: “view-source:http://www.investopedia.com/simulator/portfolio/?gameid=383710

NOTE: Because this is from a page where the user has to be signed in, you will not get the same page source code but that’s why I gave you a picture.

I have searched everywhere on the internet and cannot find any answer to my question so maybe you could help. Thanks a lot!


Source: stackoverflow-javascript

Leave a Reply

Your email address will not be published. Required fields are marked *