I got a script that searches a string in a javascript script located at an external (cross domain) HTML code (not as a .JS file, but written directly inside the HTML code).
This string is the name of a javascript variable and I want to dynamically get the value of it.
My first thought was to get the line (row) where the code is located at and then copy all the text in that line so I could get the values of it. But I can't even get the number of line it's located at.
This is the variable I want to get:
dateFuture = new Date(dateNow.getTime() + 68131000);
The problem with it, is that it changes the last 8 digits everytime you open the remote site. So that's why I need to get the value of it each time my script is loaded on my website. So the time will be syncronized.
This is my code:
$.ajax({
url: 'http://www.WEBSITENAME.com/index.php',
type: 'GET',
success: function(res) {
var headline开发者_如何学Go = $(res.responseText).find('dateFuture').text();
var deduct = indexOf(headline);
alert(deduct);
}
});
With this code, I can get the HTML and search/load the code successfully. So now I want to know how can I extract the values of dateFuture
. Or maybe only the changing number dynamically.
Any ideas?
精彩评论