Note that there are some explanatory texts on larger screens.

plurals
  1. POlocalhost != remote server
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>Any ideas? Thanks in advance.</p> <p>jQuery:</p> <pre><code>function save_words_ajax(username, save_word, save_meaning) { $.ajax({ type: "GET", url: "ajax/save_word.ajax.php", data: "username=" + username + "&amp;save_word=" + save_word + "&amp;save_meaning=" + save_meaning, dataType: "html", success: function(html){ $("#complete h2").html(html); $("#complete").show("fast"); }, complete: function(){ setTimeout('$("#complete").hide("fast")', 1500); } }); } </code></pre> <p>html:</p> <pre><code>&lt;form id="new_word_form" action="ajax/save_word.ajax.php" method="get" accept-charset="utf-8"&gt; &lt;p&gt; &lt;input type="hidden" name="username" value="someusername" /&gt; &lt;input type="hidden" name="word_reset" value="word" /&gt; &lt;input type="text" name="save_word" value="word" class="clearme" /&gt; &lt;input type="hidden" name="meaning_reset" value="meaning" /&gt; &lt;input type="text" name="save_meaning" value="meaning" class="clearme" /&gt; &lt;input type="submit" name="some_name" value="+" id="some_name" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload