javascript - Post form to web2py function using ajax -
the server written in web2py, , hosted on google app engine. can visit index.html entering domain.com/index , can send form entering domain.com/register "register" function defined default.py
however, in html, send form server , response, use ajax has cross domain issues. use "register" url, , not work. help?
$("#signup").click(function() { $.ajax({ type: "post", url: "register", data: $("#formsignup").serialize(), // serializes form's elements. success: function(data) { alert(data); } }); return false; // avoid execute actual submit of form. });
by typing domain.com/register, can totally trigger function. problem here? , form sent domain.com... in browser appears htt[://domain.com/?email=ada@ad.com&password=adsa
its possible register looking instead of post try changing type in ajax
$("#signup").click(function() { $.ajax({ type: "get", url: "register", data: $("#formsignup").serialize(), // serializes form's elements. success: function(data) { alert(data); } }); return false; // avoid execute actual submit of form. });
Comments
Post a Comment