You are here: Re: Cant figure out ajax/php problem. « PHP Programming Language « IT news, forums, messages
Re: Cant figure out ajax/php problem.

Posted by Rik Wasmus on 10/26/07 19:04

On Fri, 26 Oct 2007 18:17:00 +0200, John Doe <dod@dad.cog> wrote:

>
> <etbalex@gmail.com> wrote in message
> news:1193325679.155875.118250@d55g2000hsg.googlegroups.com...
>> Why not try another Div for messages or alerts, whenever you need to
>> display an alert make the DIV visible via CSS.
>>
>
> Well I have a DIV that messages display in that is refreshed via ajax
> every
> 5 seconds or so. basically, when someone sends a chat request, it just
> adds
> a record to a mysql database, then the ajax that refreshes that DIV on my
> page checks the database to see if there are any new chat requests.
> Unfortunately I can't seem to get any type of javascript to work when I
> call
> it in my PHP script that is being called by AJAX. (basically, the ajax
> loads up a refresh.php that simply checks the database, then echoes a
> message back to the div that says "Chat request incoming from blah blah
> blah). When i try to embedd some javascript into the page to do a quick
> alert("Youve Got Mail") the alert doesnt pop up, even though the rest of
> the
> script (the php part) executes correctly. If i run the PHP script by
> itself,
> the alert does pop up. I just dont know a whole lot about when
> javascript
> will work and when it won't, i am kind of baffled by the problem. Its
> just
> weird because it works when i run the update script seperately, but not
> when
> run as an AJAX call.

Ask about this in comp.lang.javascript, mentioning 'executing code
retrieved by XMLHTTPRequest'.
Short answer: inline code will execute on a pageload, after the page has
loaded you can add all the inline code with js you want, it won't fire
unless explicitly called by some script already running or scheduled to
run. This had nothing with the fact wether or not this is done by PHP, or
just a static HTML page retrieving a static HTML snippet.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация