Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Mobile and Form Submission
    primarykey
    data
    text
    <p>I have decided to jump into the jQuery Mobile framework for a Wordpress enabled mobile theme. </p> <p>I am now running into the issue of submitting forms with the hash tag in the url and trying to do validation and ajax posting. Basically it does not work.</p> <p>ex: website.com/contact/ &lt;- works website.com/#/contact/ &lt;- does not work </p> <p>I am aware of the rel="external" tag for href's which eliminate the # from the url. But I have blog posts with a custom plugin that renders sign up forms that I will not be able to use the rel="external" for. I guess I could use it for all links but that would eliminate the smooth transitions.</p> <p>What are my options to try and get this to work? I am trying to bind the .submit to the form, do some validation and then ajax post it. </p> <p>Update--</p> <pre><code>&lt;form id="myform" action="myfile.php" method="post"&gt; &lt;input type="text" id="mytext" name="mytext" /&gt; &lt;input type="submit" id="myform_submit" value="Submit"&gt; &lt;/form&gt; </code></pre> <p>and my script:</p> <pre><code>jQuery(document).ready(function() { jQuery("#contact_submit").submit(function(){ alert('WTF'); }); }); </code></pre> <p>Changed that to:</p> <pre><code>&lt;form id="myform" action="myfile.php" method="post"&gt; &lt;input type="text" id="mytext" name="mytext" /&gt; &lt;input type="button" id="myform_submit" value="Submit"&gt; &lt;/form&gt; </code></pre> <p>and my script:</p> <pre><code>jQuery(document).ready(function() { jQuery("#contact_submit").click(function(){ alert('WTF'); }); }); </code></pre> <p>Both do not work with the # in the url. </p> <p>I also added this BEFORE the jquery.mobile.js file:</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).bind( "mobileinit", function(){ jQuery.extend( jQuery.mobile, { ajaxFormsEnabled: false }); }); &lt;/script&gt; </code></pre> <p>Still no go.</p> <p>(FYI the jQuery instead of $ is because of WordPress)</p> <p>--another update.</p> <p>Since I am using Wordpress some of the functions are acting weird. Like is_home(). No matter what 'page' I am on the function comes back as true. I think this has to do with the ajax calls for each page.</p>
    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