Hi everybody, i'm new here and i am trying to make something with vibe.d. I have a problem with tha ajax request and the form datas.
I have this in my app.d:
/*************************************************************/
void showSearch(HttpServerRequest req, HttpServerResponse res)
{
auto output = res.bodyWriter();
parseDietFile!("search.dt", req)(output);
}
void runSearch(HttpServerRequest req, HttpServerResponse res)
{
auto output = res.bodyWriter();
output.write("params<br/>");
foreach(string s; req.params)
{
output.write(s);
}
output.write("<br/>query<br/>");
foreach(string s; req.query)
{
output.write(s);
}
output.write("<br/>cookie<br/>");
foreach(string s; req.cookies)
{
output.write(s);
}
output.write("<br/>form<br/>");
foreach(string s; req.form)
{
output.write(s);
}
}
router.get("/search", &showSearch);
router.post("/runSearch", &runSearch);
And this in the template search.dt
/************************************************************/
form(id="myform", name="myform", action="/runSearch", method="post")
label vol:
select(name="returnTicket")
option(value="false")Aller Simple
option(value="true")Aller Retour
input(name="formSubmit", type="submit", value="Search", alt="Search")
#searchResults
script(type="text/javascript")
window.addEvent('domready', function()
{
new Form.Request("myform", "searchResults");
});
/*************************************************************/
When I fill the form and submit it without ajax request, all is okay, the form data is written to the body of the page as well, but if i submit the form using ajax (via mootools Form.Request), i got nothing (req.form is empty). Have you any idea to help me?
This framework is cool. Keep up the good work. There is any irc channel where we can talk about vibe? Thanks.
Romain