|
-
Dec 6th, 2007, 07:53 AM
#1
Thread Starter
Addicted Member
[RESOLVED]javascript variable inseide php script
I have a problem about the javscript variable inside the php script.
i have a javascript inside the php
<SCRIPT SRC="../javascript/variable.js"></script>
i can use the variable at the frist time example a="my name";, but if i change the variable inside the javascript(variable.js) "a=your name";, my homepage still keep the old javascript's variable a=my name . even i had deleted the variable.js my homepage still using the old variable a=my name. does anyone know how to update the variable by javascript or it is the server problem!
Last edited by edwinho; Dec 8th, 2007 at 09:25 AM.
-
Dec 6th, 2007, 08:04 AM
#2
Re: javascript variable inseide php script
I think you are a little muddled.
PHP has nothing to do with JavaScript.
PHP is a purely server-side technology; JavaScript is purely client-side.
No JavaScript variables are persisted after the user navigates away from the page.
-
Dec 6th, 2007, 08:40 AM
#3
Thread Starter
Addicted Member
Re: javascript variable inseide php script
basically my homepage is html, just the extn is php and have some function used <?php></php> i can use the javascript variable, i feel strange why my homepage keep the variable value even i have change the variable or delete the variable.js , is it the server problem?
-
Dec 8th, 2007, 09:18 AM
#4
Thread Starter
Addicted Member
Re: javascript variable inseide php script
i find the answer from internet and want to share with other.it is javascript cache problem.
add ?new Date().getTime() at the end of script my problem solved!!
example
<SCRIPT SRC="../javascript/flyingobject.js?new Date().getTime()">
Last edited by edwinho; Dec 8th, 2007 at 09:22 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|