Python script not triggering jQuery form reset via ajaxForm -


i've searched no luck, please forgive me if redundant. i'm new python, , have simple html form (on submission) clears form, sends email via action.py script, , alerts message (alertify js) on same form page. email gets sent correctly, form not clear , not receive alert message. (stripped down) html form is:

<form id="myform" method="post" title="contact info request form"  action="action.py">     <fieldset>         <input type="text"  title="field entering name" name="name" id="name" maxlength="50" placeholder="name" />         <input type="text" title="field entering email address" name="email" id="email" maxlength="50" placeholder="email" />         <textarea title="field entering message" name="message" id="message" rows="5" cols="4" maxlength="1000"placeholder="message"></textarea>         <input type="submit" class="submit" name="submit" value="send message" />     </fieldset> </form> 

my jquery script is:

$(document).ready(function() {        $('#myform').ajaxform(function() {          $('#myform').trigger("reset");          alertify.success("message sent.  thank you!");     });  });  

and action.py script is:

#!/usr/bin/python import os import cgi, cgitb  import sys  sendmail = "/usr/sbin/sendmail" # sendmail location  form = cgi.fieldstorage()   if form.getvalue('email') not none:     = form.getvalue('email') else:     = "no-reply@domain.com" = ["actualmail@address.com"]  subject = "a message site!" name = form.getvalue('name') text = form.getvalue('message')  # prepare actual message  message = """\ from: %s to: %s subject: %s  name: %s message: %s """ % (from, ", ".join(to), subject, name, text)  # send mail p = os.popen("%s -t -i" % sendmail, "w") p.write(message) p.close() sys.exit() 

my permissions set correctly on initial form page, python script (action.py). i'm going add validations later, i'd have workign now. calling action.py directly works fine command line, want run on html form page. had action.php (essentially same in php) worked perfectly, i've been attempting make work in python. thank constructive may able offer me!

this shot in dark, try return false after trigger reset , alertify success stuff.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -