title: how to change image(img URL is everytime coming from the server) on button click in html
body: <p>I am new in client side scripting as well as stackoverflow. I want to change an image(Image URL is coming from the server everytime) of a div on click of a button or anchor. Here is My code for changing image.</p>
  
  <pre><code>$scope.captchaChange = function () {
      $http({
          method: "POST",
          url: 'http://localhost:8080/Project/captcha/captcha',
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
          }
      }).success(function (response) {
          if (response.imgUrl.length &gt; 0) {
              document.getElementById("captchaImg").src = response.imgUrl;
              document.getElementById("captchatext").value = response.imgToken;
          } else {
              alert('no captcha Image Avalable');
          }
      }).error(function (response) {
          //alert("response" + response)
          $scope.codeStatus = response || "Request failed";
          return false;
      });
  }
  </code></pre>