I've been developing / testing a site locally on a MAMP (e.g. LAMP) environment. I have a form that's processed by jQuery that works fine locally; I don't want it to be submitted, but to send the values to an AJAX function.
The issue is that it submits to the 'action' destination of the form parameter when it's run on a remote server with pretty much the same set up, e.g. Apache, PHP, etc. None of the code is different. So when I submit the form, the jQuery doesn't catch the form, it just goes ahead and submits.
Any ideas? Thanks in advance.
jQuery:
function save_words_ajax(username, save_word, save_meaning) {
$.ajax({
type: "GET",
url: "ajax/save_word.ajax.php",
data: "username=" + username + "&save_word=" + save_word + "&save_meaning=" + save_meaning,
dataType: "html",
success: function(html){
$("#complete h2").html(html);
$("#complete").show("fast");
},
complete: function(){
setTimeout('$("#complete").hide("fast")', 1500);
}
});
}
html:
<form id="new_word_form" action="ajax/save_word.ajax.php" method="get" accept-charset="utf-8">
<p>
<input type="hidden" name="username" value="someusername" />
<input type="hidden" name="word_reset" value="word" />
<input type="text" name="save_word" value="word" class="clearme" />
<input type="hidden" name="meaning_reset" value="meaning" />
<input type="text" name="save_meaning" value="meaning" class="clearme" />
<input type="submit" name="some_name" value="+" id="some_name" />
</p>
</form>