Debt - Loans - Compare - Credit Report - Credit Cards

PDA

View Full Version : NEED help to pass javascript variable to php


psyphil
May 8th 2008, 11:02 pm
I'm trying to pass a javscript variable to php to be used as a php variable.

Code looks like

<script>
screen_width=screen.width //I want to use this screen_width in php
</screen>

<?php
$screen_width= ;//I want screen_width to be assigned to this
?>

1# I dont want to pass the variable through form and $_get since it loads the page again and takes visitor to a new page. Is there any way that it could be done with $_post without redirecting but with reloading ( more suitably autoreloading .)

2# Is there a way I can assign js var to php variable with ajax,iframes ..

Any help will be appreciated.Thanks

it career
May 9th 2008, 5:25 am
I'm trying to pass a javscript variable to php to be used as a php variable.


2# Is there a way I can assign js var to php variable with ajax,iframes ..

Any help will be appreciated.Thanks

You can use java server page , write some cookie and probably read it using php.