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:
- Clean/Build my Project
- Renaming my JavaScript file (changes in this file are the one which not reflecting)
- Terminating all Launches from Console (using double cross icon)
- Terminate/Disconnect all Launches from Debug window (Right click on launch and selecting the option Terminate/Disconnect all)
- Removing all the files from the project, clean the project and copied again the files.
- Clearing browser cache/history from browser's options (Used Google Chrome 47.0.2526.106 m and Internet Explorer 11.0.9600)
- 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...
});
- 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
- ECLIPSE: Juno Release build id: 20120614-1722
- GAE PLUGIN FOR ECLIPSE: 3.8.0.v201410302155-rel-r42
CODE
- 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>
- 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!