Passing Vars

Passing Vars

Hi,

I'm looking for some advice on how to best achieve the following:

The user inputs an id into a text field of an HTML form. Once submitted I want to execute a database query which will return a number of records/rows which should be output to the screen.

I'm using an ajax request to call a PHP script which will query the database when the button of the form is submitted. The number of rows returned by the database query will determine different HTML output.

When the data from the query is returned I want to fade a div in display the data. What is the best way of achieving this? I know I can return the variables to the ajax call and output some html within the success parameter. Is this the best practice? It seems bit clumsy and long winded especially if there is a lot of html to output.

Is there a way to psss the result right back to the original php script which invoked the ajax call?

Thanks,

Johnny.