سؤال

I am using html, javascript & mod_python. I want to submit html form. To do this I used

document.formName.submit();

after submitting I want to redirect to new page. I tried location="newpage.html" but this is not working.

هل كانت مفيدة؟

المحلول 3

Req.write('<script>location.href="page.py?fn=xxx";</script>')

At the end of the python function that to be executed while submit

نصائح أخرى

Unless you're submitting the form with AJAX then submitting will take the user to a new page, so you can't do a javascript redirect.

You could redirect on the server side, or change the action of the form.

Use ajax to submit the form. Then onSuccess callback, set window.location = new_url.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top