Jump to content

Recommended Posts

Posted (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 by TechSupp
Posted
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!
Posted
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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...