I’m having trouble trying to get JQuery perform the same action a form would perform. I have the following form which works exactly as I want:
<form method='get' action='/editor'>
<input name='r'>
<input name='c'>
<input name='t'>
<input type='submit'>
</form>
The handler on the servor for /editor simply redirects the page with the r, c & t parameters in the url. This works exactly as I want it too.
Now, I’m trying to do exactly the same thing but with JQuery, this is what I have so far:
$.get("/editor", { r: "foo", c: "bar", t: "meow" } );
The request is sent as can be seen from the console log: XHR finished loading but the page is not redirected to /editor
My question is how can I perform exactly the same function as the html form but in JQuery?
Thank you all for you help 🙂
You have to redirect to
/editoryourself. If you want to do exactly what the form does normally including redirect, there’s really no point in having JavaScript do it at all. However, since you asked: