0

I am asking this question after looking for an answer to my problem from past two days.

THINGS ALREADY TRIED

I have tried following things in eclipse:

  1. Clean/Build my Project
  2. Renaming my JavaScript file (changes in this file are the one which not reflecting)
  3. Terminating all Launches from Console (using double cross icon)
  4. Terminate/Disconnect all Launches from Debug window (Right click on launch and selecting the option Terminate/Disconnect all)
  5. Removing all the files from the project, clean the project and copied again the files.
  6. Clearing browser cache/history from browser's options (Used Google Chrome 47.0.2526.106 m and Internet Explorer 11.0.9600)
  7. Used this code

$("#form-contact-form").on('click', '#btn-contact-from-submit', function () { //my code goes here... });

instead of

$('#btn-contact-from-submit').click(function(){ //my code goes here... });

  1. Used <script type="text/javascript" src="js/page-contact.js?123"></script> also

MY PROBLEM

I am making a small change, that is adding an event listener to a button element in my html file. I have added an alert('Sending Message'); too in the listener so that it triggers the alert as soon as it enters the listener code. Previously it was working. But from past two days, whatever changes I do are not reflecting.

ECLISPE AND GAE PLUGIN VERSION

  1. ECLIPSE: Juno Release build id: 20120614-1722
  2. GAE PLUGIN FOR ECLIPSE: 3.8.0.v201410302155-rel-r42

CODE

  1. HTML BUTTON ELEMENT

<form action="contact" method="post" id="form-contact-form">
  <div class="col-md-100 fadeInBottom"><button type="submit" id="btn-contact-from-submit">Let it go!</button></div>
</form>
  1. JAVASCRIPT LISTENER

$(document).ready(function() {

  $('#btn-contact-from-submit').click(function() {
    alert('sending message first');
    var isFormValidated = false;
    isFormValidated = true; //making condition true
    if (isFormValidated) {
      alert('sending message');
      $("#btn-contact-from-submit").html('Wait! It is going!');
      $("#btn-contact-from-submit").prop('disabled', false);

      $("#form-contact-form").submit(function(e) {
        var postData = $(this).serializeArray();
        var formURL = $(this).attr("action");
        $.ajax({
          url: formURL,
          type: "POST",
          data: postData,
          success: function(data, textStatus, jqXHR) {
            //data: return data from server
            $("#btn-contact-from-submit").html('It went! Thank you!');
          },
          error: function(jqXHR, textStatus, errorThrown) {
            //if fails
            alert('Crashed!');
          }
        });
        e.preventDefault(); //STOP default action
        e.unbind(); //unbind. to stop multiple form submit.
      });

      $("#form-contact-form").submit(); //Submit  the FORM
    }
  });

});

I am including the JavaScript file just before the body is ending

  <script type="text/javascript" src="js/page-contact.js"></script>

Can anyone please help me in this?

If I missed to include any information, please inform me and I will update my question.

Thank You Community!

0 Answers0