title: my smart contract is not responding and error saying web3 is not defined
body: <pre><code>[error saying web3 is not defined][1]&lt;script&gt;
      var myContract;
      async function CheckMetamaskConnection() {
          // Modern dapp browsers...
          if (window.ethereum) {
              window.web3 = new Web3(window.ethereum);
              try {
                  // Request account access if needed
                  await ethereum.enable();
                  // Acccounts now exposed
                  return true;
              } catch (error) {
                  // User denied account access...
                  return false;
              }
          }
          // Legacy dapp browsers...
          else if (window.web3) {
              window.web3 = new Web3(web3.currentProvider);
              // Acccounts always exposed
  
              return true;
          }
          // Non-dapp browsers...
          else {
              console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
              return false;
          }
      }
  
      $(document).ready(async function () {
          var IsMetamask = await CheckMetamaskConnection();
          if (IsMetamask) {
              myContract = await web3.eth.contract(SmartContractABI).at(SmartContractAddress);
              getCandidate(1);
              getCandidate(2);
  
              await myContract.eventVote({
                  fromBlock:0
              }, function(err, event){
                  console.log(&quot;event :&quot;, event);
                  getCandidate(event.args._candidateid.toNumber());
              });
              console.log(&quot;myContract :&quot;, myContract);
              console.log(&quot;Metamask detected!&quot;)
          } else {
              console.log(&quot;Metamask not detected&quot;);
              Swal.fire({
                icon: 'error',
                title: 'Oops...',
                text: 'Metamask not detected!',
                onClose() {
                  location.reload();
                }
              });
          }
      });
  
      async function getCandidate(cad){
          await myContract.candidates(cad, function(err, result){
              if (!err) {
                  console.log(&quot;result : &quot;, result);
                  document.getElementById(&quot;cad&quot; + cad).innerHTML = result[1];
                  document.getElementById(&quot;cad&quot;+cad+'count').innerHTML = result[2].toNumber();
              }
          });
      }
  
      async function Vote(cad){
          await myContract.vote(cad, function(err, result){
              if(!err){
                  console.log(&quot;We are winning!&quot;);
              } else{
                  console.log(&quot;Can not connect to the smart contract&quot;);
              }
          })
      }
  
  &lt;/script&gt;`
  </code></pre>
  <p>i have node.js and metamask in my system(windows 10)
  i cloned you project from github and runned it by following command</p>
  <p>npm install
  node index.js
  the UI deployed perfectly in localhost:3000 but when i try to vote the transaction is not working!!!
  then i saw content on smart contract is not rendering!!!
  then i checked metamask , which was connected and have 1 ether on ropsten network!!!
  then i try ganache (local blockchain provider) and still the transaction is not working!!!
  then i paste the smart contract in remix and get the ABI and smart contract address and still not working!!!
  then i goto developer tool of browser and saw below error!!!!...i have no idea of this error!!!!...how can i solve this???</p>