Re: How to call external php script from html? [message #172986 is a reply to message #172971] |
Mon, 14 March 2011 22:01 |
astral
Messages: 14 Registered: February 2011
Karma:
|
Junior Member |
|
|
"Erwin Moller" wrote:
>>> Here is an example using JavaScript.
>>> I would advise you to add some anti-caching approach like adding the
>>> number of milliseconds since Unix Epoch (I added that in my example).
>>> So try something like this:
>>> <script type="text/javascript">
>>> var myPHPScript = "http://www.example.com/myScript.php";
>>> var milliSecSinceUE = (new Date()).getTime();
>>> var myFakeImage = new Image();
>>> myFakeImage.src = myFakeImage+"?nocache="+milliSecSinceUE;
>>> </script>
>>> In case your PHPscript had data in the URL already, eg:
>>> http://www.example.com/myScript.php?article=34
>>> You must change the ? in a&.
>>> Also, I am polluting the global namespace with all the vars, some maybe
>>> it's better to put it in a function if you care.
>>> Regards,
>>> Erwin Moller
>> -------------------
>> Thank you for the help, Erwin. I tried script, but it not working for
me.
>> Server log show info that "File not found":
>> File not found [/hsphere/local/home/domain/domain.com/eng/4ar/[object
>> HTMLImageElement]]
>> Hosting support said that this error definitely related to my
javascript.
>> Thanks,
>> astral
> Hi Astral,
>
> That is because my code was not tested. ;-)
>
> He is a better version:
>
> <script type="text/javascript">
> var myPHPScript = "http://www.example.com/myScript.php";
> var milliSecSinceUE = (new Date()).getTime();
> var myFakeImage = new Image();
> myFakeImage.src = myPHPScript +"?nocache="+milliSecSinceUE;
> </script>
>
> (The last line was wrong.)
>
> Hope that works for you.
>
> Regards,
> Erwin Moller
>
Hi,
it's not working also.
astral
|
|
|