TechSupp Posted October 8, 2015 Posted October 8, 2015 (edited) I have a java script that we use as a shortcut for a subscription based website that the kids use and need to enter username and password (same for all pupils) which has worked fine until now that the company has redesigned the login page. I've managed to get the scripts to now enter the details and log me in (checked by going to the home page and I am logged in) but it will not automatically load a page after submitting the details. How do I get javascript to load a web page after submitting data? This what I have so far and yes the company are quite happy for me to automate the login process for pupils in school. I would like it once logged in to go to "http://www.interactive-resources.co.uk/myfolders" function loginpage_onload() { document.forms[0].username.value = '######'; document.forms[0].password.value = '######'; document.forms[0].submit(); } all I get so far is logged in but the following displayed: {"data":" \n Logged in as hps-pupil<\/div>\n View Folders<\/a><\/div>\n Resources<\/a><\/div>\n <\/a>\n <\/div>\n <\/div>","status":"success"} Edited October 8, 2015 by TechSupp
edmokeski Posted October 8, 2015 Posted October 8, 2015 Does the form not redirect on submit? You can use window.location.assign() to send someone to another page (the parameter is the full URL in quotes). See JavaScript Window Location for more info.
SteveM555 Posted October 8, 2015 Posted October 8, 2015 It looks like the website is returning JSON data; they're probably using AJAX for the login page/form on the website... Not sure how to get around it either!
edmokeski Posted October 8, 2015 Posted October 8, 2015 Also, is it possible that their dologin will take a parameter (e.g. via hidden field) telling it what to do with you after successfully logging in?
TechSupp Posted October 8, 2015 Author Posted October 8, 2015 Thanks, gives me some pointers to look at, will have another look when I get 5 min.
TechSupp Posted October 8, 2015 Author Posted October 8, 2015 Does the form not redirect on submit? You can use window.location.assign() to send someone to another page (the parameter is the full URL in quotes). See JavaScript Window Location for more info. Had a go at that and if its after the submit statement nothing happens, if its after the function section it passes me to the page but does not log me in! Why did they had to change it, was working so well before!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now