I am creating a web app where an object property is creating upon clicking a button in the inputs.html page. However, results.html needs access to the created property to prompt the user to save it in firestore.
- I have already tried importing and exporting the variable but get this error: Uncaught SyntaxError: Unexpected token ).
- I have tried creating a const variable property in inputs.html that changes using my script but I cannot access it in results.html.
- I have also screated a script tag in results.html linking to the javascript file where property is created.
Here is inputs.js used to create property and imported in inputs.html.
//create a property and go to results page
document.getElementById("createProperty").addEventListener("click", ()=>{
property= new Property( document.getElementById("address").value, ..., );
window.location = "../Frontend/results.html";
});
}
Here is the code in results.js that calls property and is in the results.html page.
document.getElementById("test").addEventListener("click",(e)=>{
//example of a possible output
console.log(property.address);
});
I would like for the console to log askprice. However, the error received is: Uncaught ReferenceError: property is not defined.
I was wondering what are the methods I could use to access property between these javascrip files.