<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<script src="https://github.com/ethereum/web3.js/blob/develop/dist/web3.min.js" type="text"></script>
<h1>My Test</h1>
<div id="output"></div>
<button id="button">Click</button>
<script>
window.addEventListener('load', function() {
if(typeof web3 !== undefined) web3js = new Web3(web3.currentProvider);
document.getElementById("button").addEventListener("click", function() {
getMyStringArray();
}, function(error, result){}, false);
});
var contractInstance;
var contractABI = [
{
"constant": false,
"inputs": [
{
"name": "newEntry",
"type": "string"
}
],
"name": "addToMyStringArray",
"outputs": [],"payable":
false,"stateMutability": ","type": "function"},{"inputs": [], "payable": false,
"stateMutability": "nonpayable",
"type": "constructor""function"
},
{
"constant": true,
"inputs": [],
"name": "getMyStringArray",
"outputs": [
{
"name": "",
"type": "string[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
];
var contractAddress = "0x8fcb440a8ba9df8ea91493be3bd27ab562d04386";
<!-- Contract Address is on the Rinkeby Test Network -->
contractInstance = web3.eth.contract(contractABI).at(contractAddress);
function getMyStringArray() {
contractInstance.getMyStringArray(function(error, result){
document.getElementById("output").innerHTML = result;
});
}
</script>
</body>
</html>
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Felix Dolderer
- 245
- 1
- 8