lundi 13 février 2017

JavaScript created button not calling JavaScript function

Vote count: 0

I have created a form in a Ruby on Rails application that runs user selected scripts by making AJAX calls to a ruby controller. The response is put into a JavaScript generated element, with no reloading of the page. In the JavaScript generated element I create a button for downloading the contents of the result element. The download button is supposed to perform another AJAX call to a ruby controller method that will save the results as a file, then send it to the user. The JavaScript is all together in one file, so I know it is linked properly, but watching the Network tab of Firefox's developer tools shows no calls from the Download button to the Rails server.

Element Creation Javascript (calls fine)

if(document.getElementById("dig").checked == true)
{
  $('#dig_wait_img').addClass('hidden');
  $('#dig_loading_img').removeClass('hidden');
  results = $.ajax({
    type:"POST",
    url: "/console/discovery/dig",
    data: { domain_name : domainInput },
    success: function(data) {
      $('#dig_loading_img').addClass('hidden');
      $('#dig_check_img').removeClass('hidden');
      $("#results")
      .append(
        $("")
        )
        .append(
          $("
") .append( $("
" + data["value"] + "

") ) ) .append( $("
")
        )
        .append(
          $("
asked 29 secs ago

Let's block ads! (Why?)



JavaScript created button not calling JavaScript function

Aucun commentaire:

Enregistrer un commentaire