• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Opinions Wanted: Projects organization for AJAX

#1
[eluser]beyondwords[/eluser]
I am using a fair amount of AJAX in my project (information management for a medium-sized non-profit).

Currently I am using Prototype/Script.aculo.us for the AJAX functionality.

I would like to know how people organize their PHP/HTML bound to be returned through an AJAX.Request object.
Currently i have something like:

Code:
$return_str ='';
        if ($query->num_rows() > 0)
        {
            $return_str .= "<table width=\"100%\">\n";
            ...
            foreach ($query->result() as $row)
            {
                ...
                $return_str .= "<tr id=\"some_$some_id\">\n<th>$row->some_name</th>\n";
(where ... is omitted code for the sake of brevity).

For the brief time I used Rails, there was a function (render :partial => 'name_of_file') similar to a php include that would allow me to send bits of rhtml (ruby-enhanced html) back as the response to an AJAX.Request.

So far I have been using the technique above of feeding everything to a string manually. My impression is that neither File Helper read_file() function nor a straight include will quite cut it. (I haven't exhausted these options because I have more to do than time in which to do it... so for the moment I'm chugging along with what I have).

So my question:
Is there a way to render a bunch of PHP-laced HTML and send it back as the response to an AJAX.Request?

Thanks in advance for your responses!


Messages In This Thread
Opinions Wanted: Projects organization for AJAX - by El Forum - 07-18-2007, 05:46 PM
Opinions Wanted: Projects organization for AJAX - by El Forum - 07-19-2007, 03:50 AM
Opinions Wanted: Projects organization for AJAX - by El Forum - 07-19-2007, 08:31 AM
Opinions Wanted: Projects organization for AJAX - by El Forum - 07-19-2007, 02:36 PM
Opinions Wanted: Projects organization for AJAX - by El Forum - 07-19-2007, 11:51 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.