Script: dynamic Ajax content

Hi, this is my first post on these forums, wondering if someone could offer some kind advice...

I have a page with a form which accepts user keywords/tags, then does a php search for photos matching these keywords on the flickr photosharing database. The photo details are returned by a php-based interface (called phpflickr) from which I construct the urls of the matching photos. I then process and display these photos on my page.

Previously I hard-coded keywords into my page so both php and javascript were all in the one single page. As it loaded it could do the php search and find the details, which I then passed back into my Javascript variables by means of "echo" statements.
But now that I am accepting form input, I have to call the php after the form is submitted, so I am trying to use Ajax and do the php search in an external php routine.

Using this Ajax method, I now cannot access the values of the php variables from javascript.

I have tried many many ways, the latest being by outputting a list of URLS in the form ['url1','url2',....] from the ajax-called php routine and capturing them in Javascript with:
max_array = page_request.responseText;
or by:
max_array = eval(document.getElementById("photolist").value);
(where "photolist" is the id of a DIV whose content is the URL list)

But in both cases the list of URLs is simply displayed on screen instead of held internally, so I get the errors:
max_array has no properties
document.getElementById("photolist") has no properties

So my question is using Ajax, how can I "output" from my called page in a format that I can capture back in the calling page?

The test pages I am using are at:

page_request version: (calling page) (ajax-called php) (ajax-called php but in htm format for readability)

DIV version: (calling page) (ajax-called php) (ajax-called php but in htm format for readability)

Advice would be most appreciated and if possible some example code would be great as I am a php beginner!

Thanks in advance for any help...