Here's the dilemma. I'm voting on these different reports on webpage #1 (http://www.blankmediagames.com/Trial/#start) and I'm trying to get a specific object called "data" from webpage #2 (http://www.blankmediagames.com/Trial/viewReport.php?id=1388499). However, when I use this code, it only returns the entire webpage.
var tempVar;
var reportPage = new XMLHttpRequest();
reportPage.open('GET', '/Trial/viewReport.php?id=1388499', true);
reportPage.onreadystatechange = function() {
if (reportPage.readyState === 4) {
tempVar = (reportPage.responseText);
}
};
reportPage.send(null);
I am trying to grab the object called "data" from webpage #2 and store it in another variable while I'm on webpage #1. Is there any way I can do this?
This is basically what is found in webpage #2:
<!DOCTYPE html>
...
<script>
$(document).ready(function()
{
data = {"ReportID":"1388499","Username":"FatJellyBean","ReportFile":"Report1386875","Reason":"Gamethrowing","Appeal":"","Submitted":"Jun. 10, 2018 12:41 pm","numReports":2,"players":[{"username":"TooEzJukedBaited","ign":"ImJester","role":"SerialKiller","slot":1},{"username":"RISTR1K","ign":"Covfefe","role":"Doctor","slot":2},{"username":"balintka0607","ign":"William Phips","role":"Retributionist","slot":3},{"username":"JohnGotti","ign":"Karl Marx","role":"Veteran","slot":4},{"username":"Konrad4123","ign":"Pepe","role":"Escort","slot":5},{"username":"Celerian","ign":"Jeff","role":"Jester","slot":6},{"username":"foxesfan9","ign":"dabbingisnotcool","role":"Executioner","slot":7},{"username":"FatJellyBean","ign":"ifyoudonthitsubm","role":"Medium","slot":8},{"username":"GalaxyUnivern","ign":"Eliza Macbeth","role":"Godfather","slot":9},{"username":"Davve27","ign":"Katana","role":"Investigator","slot":10},{"username":"GayBobFaggyPants","ign":"Sarah Bishop","role":"Godfather","slot":11},{"username":"holysilman","ign":"Lil Tay","role":"Sheriff","slot":12},{"username":"pingvingen","ign":"Garfunkle","role":"Lookout","slot":13},{"username":"fefecute","ign":"Fefecute","role":"Framer","slot":14},{"username":"Frogers98","ign":"James Russel","role":"Jailor","slot":15}]};
Trial.populateFilter(data);
$
$('.reportedPlayer').html($('#FatJellyBean').next().html());
$('#highlighter').show();
});
function highlight(elem,start,end)
{
var el=elem[0];
var eln= (el.children.length > 0) ? el.lastChild : el.childNodes[0];
var range=document.createRange();
var sel=window.getSelection();
start = (typeof start != 'undefined') ? start : 0;
end = (typeof end != 'undefined') ? end : el.innerHTML.length;
if(el.children.length > 0) start = end = 0;
range.setStart(eln,start);
range.setEnd(eln,end);
sel.removeAllRanges();
sel.addRange(range);
el.focus();
}
</script>
...
</html>