penislandbic Posted February 22, 2014 Share Posted February 22, 2014 I'm trying to use JavaScript to redirect to a PHP page that GETs a logout variable and checks to see if it's true. This is what I have function logout() { window.location.href = "index.php?logout=true"; } When I invoke the logout() function, it redirects to "index.php?". It completely ignores the "logout=true" part. How can I fix this? Link to comment https://forums.phpfreaks.com/topic/286420-location-href-not-adding-php-get-address/ Share on other sites More sharing options...
.josh Posted February 22, 2014 Share Posted February 22, 2014 that doesn't sound like a problem with javascript, but a problem with server-side settings or coding. Ex: .htaccess mod rewrite doing a redirect and not passing the query string, or code in index.php itself doing a redirect and not passing the query string Link to comment https://forums.phpfreaks.com/topic/286420-location-href-not-adding-php-get-address/#findComment-1470096 Share on other sites More sharing options...
penislandbic Posted February 22, 2014 Author Share Posted February 22, 2014 I tested it on a Liniux server from Host Gator and WAMP server on my local computer and both give the same result. I have different .htaccess files on either one. Link to comment https://forums.phpfreaks.com/topic/286420-location-href-not-adding-php-get-address/#findComment-1470110 Share on other sites More sharing options...
penislandbic Posted February 23, 2014 Author Share Posted February 23, 2014 I figured out why it wasn't working. I had the button in a form that had an onSubmit attribute. I never put return false in the function so the form refreshed the same page. It's my fault. There was nothing wrong with my server. Link to comment https://forums.phpfreaks.com/topic/286420-location-href-not-adding-php-get-address/#findComment-1470204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.