Page 1 of 1
AJAX? + PHP + .txt
Posted: Wed Jan 23, 2008 11:00 am
by Hugo F
Hello,
I have a file .txt (it's read in php page with ajax) and which is empty, but once you get anything I wanted to open a URL in a pop-up automatically.
How?
Thanks,
Hugo Fernandes
Re: AJAX? + PHP + .txt
Posted: Wed Jan 23, 2008 11:12 am
by Zoxive
We are going to need a better description of your question, and possibly even code to reference.
I have no idea what you are asking.
All I can understand is:
- You have a Txt File
- Text File is being opened with php, from a Ajax call
- ??
Hugo F wrote:but once you get anything I wanted to open a URL in a pop-up automatically.
Get the Servers Response from the Ajax call?
Re: AJAX? + PHP + .txt
Posted: Wed Jan 23, 2008 11:28 am
by Hugo F
Zoxive wrote:We are going to need a better description of your question, and possibly even code to reference.
I have no idea what you are asking.
All I can understand is:
- You have a Txt File
- Text File is being opened with php, from a Ajax call
- ??
Hugo F wrote:but once you get anything I wanted to open a URL in a pop-up automatically.
Get the Servers Response from the Ajax call?
I have this:
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script src="prototype.js" type="text/javascript"></script>
<script src="scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript"> var ajaxPopulater = function (id,url)
{ url = url + '?StopCache=' + new Date; new Ajax.PeriodicalUpdater(id, url,
{ method: 'post', frequency: 0.5, asynchronous: true, decay: 0.5 }); } </script>
<title>TestAjax</title>
</head>
<body onload="javascript:ajaxPopulater('latest','test.txt')">
<div id="as">
</div>
<div id="latest"></div>
</body>
</html>
It's work!
1º The file is empty.
2º The file isn´t empty
3º Appears the new data and the code I have post show the new data (it's work)
4º Open URL in Pop-up (when the file isn´t empty) - (this is my quest)
Re: AJAX? + PHP + .txt
Posted: Wed Jan 23, 2008 6:08 pm
by Hugo F
No idea??
Re: AJAX? + PHP + .txt
Posted: Fri Jan 25, 2008 3:41 am
by Hugo F

Please help me!
Re: AJAX? + PHP + .txt
Posted: Fri Jan 25, 2008 9:51 am
by pickle
To answer your question (or at least move it along), when you get a response to your AJAX call, do you not know then what the contents of the file were? You can do a simple
Code: Select all
if(ajaxContents != ''){ alert('Popup message');}
You can replace the alert() with window.open() if necessary.
Is the PHP side working? If so, this is a client-side question & I can move it there.
Re: AJAX? + PHP + .txt
Posted: Fri Jan 25, 2008 11:16 am
by Hugo F
Is the client-side.
But if exist any resolution...
Tanks,
Hugo