views:

84

answers:

1

Hi,

I have to re-write a few php pages in in Grails (don't ask why!). I have never done any php, so it's proving a little tricky.

Basically I have a html page which has a function in it that is executed every 60 seconds, and that .js creates a new XMLHttpRequest which then does xmlHttp.open("GET", "myphpfile.php", true);

I can get the .js to be called from the gsp no problem at all - but what on earth do I do with the php? I assume I could create a service which would do something similar, but can that be accessed from the .js?

Please help - I am totally stuck!

+1  A: 

Work out what the thing's meant to do, draw some pretty UML, write some documentation, then dump the PHP.

Unless you properly understand what the system as a whole is meant to do, you'll end up trying to do PHP-style stuff in Grails which is a very bad idea. Writing it from scratch in Grails will let you use proper Groovy tricks (closures etc) and it will end up a better system.

You'll also be left with some documentation, which is always nice.

Emyr