Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy am I seeing a value of "undefined" on screen when I submit form in jQuery Mobile?
    primarykey
    data
    text
    <p>This is my contactus.html page. I am submitting to a php page on the server that is to take the information and send email alongw ith saying thank you. When I do submitthe form, all I see is "undefined" on screen even though I am able to get the email.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Contact Us&lt;/title&gt; &lt;link rel="stylesheet" href="css/latestjquerymobile.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="css/jquery.mobile.simpledialog.min.css" /&gt; &lt;script type="text/javascript" src="js/jquery-1.6.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/latestjquerymobile.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery.mobile.simpledialog.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#contactus").submit(function(event) { alert("page submitted"); }) }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page" data-theme="e" id="contactus"&gt; &lt;div data-role="header" data-position="fixed"&gt; &lt;h1&gt;Contact Us&lt;/h1&gt; &lt;a href="home.html" data-icon="back" class="ui-btn-left" data-ajax="false"&gt;Back&lt;/a&gt; &lt;a href="home.html" data-icon="home" class="ui-btn-right" data-ajax="false"&gt;Home&lt;/a&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div data-role="content"&gt; &lt;div align="center"&gt; &lt;form action="http://testsite.com/contactus.php" name="contactus" id="contactus" method="post"&gt; &lt;fieldset&gt; &lt;div data-role="fieldcontain"&gt; &lt;label for="name"&gt; Name:&lt;/label&gt; &lt;input id="name" name="name" type="text" /&gt; &lt;label for="email"&gt;Email:&lt;/label&gt; &lt;input id="email" name="email" type="text" /&gt; &lt;label for="contact"&gt;Contact:&lt;/label&gt; &lt;input id="contact" name="contact" type="text" /&gt; &lt;label for="message"&gt;Message:&lt;/label&gt; &lt;textarea rows="4" cols="50" id="message" name="message"&gt;&lt;/textarea&gt; &lt;br /&gt; &lt;button type="submit" name="submit" value="submit-value"&gt;Send&lt;/button&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;/form&gt; &lt;div&gt;&lt;br&gt;&lt;br&gt; &lt;a href="http://www.facebook.com/Apsession"&gt;&lt;img src="images/facebook.png" border="0" /&gt;&lt;/a&gt; &lt;a href="http://twitter.com/ApsessionMobile"&gt;&lt;img src="images/twitter.png" border="0" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is the code for contactus.php on server</p> <pre><code>&lt;?php $ToEmail = 'test@testemail.com'; $EmailSubject = 'Contact Form Submission from testsite.com'; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$_POST["name"]."&lt;br&gt;"; $MESSAGE_BODY .= "Email: ".$_POST["email"]."&lt;br&gt;"; $MESSAGE_BODY .= "Contact: ".$_POST["contact"]."&lt;br&gt;"; $MESSAGE_BODY .= "Message: ".$_POST["message"]."&lt;br&gt;"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?&gt; &lt;html&gt; &lt;body&gt; THANK YOU &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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