I tried these:
alert(’[testglobal]’); -> prints the name of the global: [testglobal]
alert("[testglobal]"); -> prints the name of the global: [testglobal]
alert([testglobal]); -> gives javascript error: testglobal is undefined
please help me out.
I tried these:
alert(’[testglobal]’); -> prints the name of the global: [testglobal]
alert("[testglobal]"); -> prints the name of the global: [testglobal]
alert([testglobal]); -> gives javascript error: testglobal is undefined
please help me out.
Re: can I use globals in javascript event?
Several methods:
<script>
var whatever = "<?php= $phpVar ?>";
</script>
<?php
$r = $_GET['Result'];
?>
Regards,
Scott.
Re: can I use globals in javascript event?
how would you do the opposite of that, like return a javascript variable into a php variable?
Re: can I use globals in javascript event?
In reading on this, there are several ways.
Have the script reload the page:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!-- //
document.write('<a href="another_page.php?name=Dave&number=100">another page</a>');
// -->
</SCRIPT>
or
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!-- //
var name="Dave";
var number=100;
document.write('<a href="another_page.php?name='+name+'&number='+number+'">another page</a>');
// -->
</SCRIPT>
The other option would be to use AJAX. It allows communication without having to reload the page. I can post some examples after lunch if needed.
Regards,
Scott.
Re: can I use globals in javascript event?
thats alright, thanks for the help though. You got me thinking with your first post, and I was able to figure out the problem I was having. I now have the save button prompt the user, and save the record if they click ok. I tried reloading the page and adding something to the URL, but that didn’t work because it was getting rid of all the form data.