Jump to content

Run .php in background ? [JavaScript]

HiddenFox
Go to solution Solved by beigedenim,

ajax

 

So this should be simple for you web coders out there.

How do I get this code / equivalent to run in the background of the webpage without a new window opening?

 

function strobe_submit() {
    window.alert("Speed: " + speed_final + " Time: " + time_final); 
    window.open("/strobe.php?time=" + time_final + "&speed=" + speed_final, '_blank');
}

SOLUTION:

function strobe_submit() {
    window.alert("Speed: " + speed_final + " Time: " + time_final); // USed for debug
    var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("GET", "/strobe.php?time=" + time_final + "&speed=" + speed_final, true);
        xmlhttp.send();
}

 

Thanks, Kie.

PC Editing / Gaming Rig Specs : i7-3930k @ 4ghz w/ Hyper 212 Evo | 840 Evo 250gb and Seagate 1TB | 2x8GB Corsair Vengeance RAM | Zotac GTX 780 | Corsair Vengeance C70 Green | OS: Ubuntu 16.04 LTS / Win10 #KilledMyWife #MakeBombs

Link to comment
Share on other sites

Link to post
Share on other sites

Put it in an iframe? Which is or isn't hidden?

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Dutch-stoner said:

Put it in an iframe? Which is or isn't hidden?

No. Never use frames this isn't 1995

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

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

×