2013-05-08 54 views
0

服務器是寫在web2py中,並在谷歌應用程序引擎託管於web2py的功能。我可以通過輸入domain.com/index訪問我的index.html,我可以通過輸入domain.com/register其中「註冊」發送形式是通過default.py定義形式後使用AJAX

然而功能,在HTML中,在那裏我會喜歡的形式發送到服務器,並得到迴應,我用ajax其中有跨域問題。所以我用「註冊」的URL,而這是行不通的。幫幫我?

$("#signup").click(function() { 
$.ajax({ 
     type: "POST", 
     url: "register", 
     data: $("#formsignup").serialize(), // serializes the form's elements. 
     success: function(data) 
     { 
      alert(data); 
     } 
    }); 

return false; // avoid to execute the actual submit of the form. 
}); 

通過鍵入domain.com/register,我可以完全觸發該功能。這裏有什麼問題?並且表單被髮送到domain.com ...在瀏覽器中,它顯示爲htt [://domain.com/?[email protected] & password = adsa

+0

您嘗試過輸入「GET」嗎? – 2013-05-08 20:55:18

回答

0

它的非常可能的寄存器是尋找GET而不是POST 嘗試更改ajax中的類型

$("#signup").click(function() { 
$.ajax({ 
     type: "GET", 
     url: "register", 
     data: $("#formsignup").serialize(), // serializes the form's elements. 
     success: function(data) 
     { 
      alert(data); 
     } 
    }); 

return false; // avoid to execute the actual submit of the form. 
});