2013-04-01 33 views
0

我想在Google應用引擎的HTML頁面中使用Form post方法或ajax post方法,但似乎沒有發生任何事情。在HTML頁面上形成POST方法

class Email(webapp2.RequestHandler): 
    def post(self): 
     ''' 
     Post method to handle Email requests. 
     ''' 
     print self.request 
     self.response.write(self.request) 

app = webapp2.WSGIApplication([('/', MainPage),("/email",Email)], 
           debug=True) 

<form method="post" action="http://localhost:8080/email" > 
<p> 
    <label for="byour_name">Your name</label><input type="text" name="byour_name" value="" id="byour_name"> 
</p> 
<p> 
    <label for="byour_email_address">Your email address</label><input type="text" name="byour_email_address" value="" id="byour_email_address"> 
</p> 
<p> 
    What's on your mind?<br> 
    <textarea name="Message" rows="10" cols="25"> 
    </textarea> 
</p> 
<p> 
    <input type="submit" value="Send it!"> 
</p> 

可一些幫助,這我也嘗試Wireshark來檢查網絡活動,但什麼也沒發生..

+0

但是,如果我申報內我的app.py文件,那麼它的工作是。但是,如果我嘗試從我的index.html中聲明的表單發佈它不起作用 –

+0

您是否嘗試過使用相對路徑而不是絕對路徑? – 2013-04-01 16:07:52

+0

但兩者都沒有發生...... –

回答

0

,我發現我的問題。我爲有刪除下面提到線,我用前面

$("form").bind("submit",function(event){ 
            event.preventDefault(); 

只要我刪除它。它的工作..