[FX.php List] [Poll] Which ajax implementation do you use?

Andy Gaunt andy at fmpug.com
Thu Oct 4 19:47:06 MDT 2007


Joel,

You do not have to write multiple functions for LAJAX to target  
specific divs.

If you have a function as such:

var targetDiv = null;
	
function updateDynamic()
	{
		var updateDIV = document.targetDIV;
		if(Lajax.state() == 4) {
			document.getElementById(updateDIV).innerHTML=Lajax.result();
		} else {
			document.getElementById(updateDIV).innerHTML="Please wait...";
		}	
	}

Your LAJAX request could then be:

<a href="javascript:document.targetDIV='update<?php echo  
$currentRecord; ?>';Lajax.post(url,updateDynamic,{parameters};">Link  
text here</a>


With the targetDIV being a unique DIV ID and the Lajax.post or  
Lajax.get targeting that div. One function to cover all your bases.

Hope this helps.

Andy Gaunt
T: 321-206-3658
andy at fmpug.com
http://www.fmpug.com

FMPug: A Developer's best Friend!


On Oct 4, 2007, at 3:42 PM, Joel Shapiro wrote:

> Hey Gjermund
>
> I started using LAJAX because it was so ready-to-use without having  
> to know much about JavaScript or AJAX.
>
> I've recently been getting into jQuery, and just discovered how to  
> do something that's really pushing me to use jQuery more:
>
> In LAJAX, you need to specify the <div> that the callback will go  
> to.  In my current project, I have many divs (cells in a table)  
> that can each get refreshed through an AJAX call to the DB.*  With  
> LAJAX I needed to either reference by ID the specific DIV in each  
> link, or create multiple LAJAX functions -- one for each div,  
> (which I might have had to do due to the limitations of a jQuery  
> plugin I was using).  Anyway, jQuery has a command called "this",  
> which acts on the DOM** element that triggers the action -- so you  
> don't need to specify WHERE to do an action... jQuery knows exactly  
> where via its use of "this".  On top of that, there are various  
> methods to 'traverse' the DOM, such as "parents" which goes up the  
> hierarchical ladder of the DOM starting at the "this" element and  
> stopping at whatever element you specify.  For instance:
>
> I've got something like:
>
> <div class="cell">
>   <div class="year">
>     <ul class="year">
>       <li>
>         <a>xyzlink</a>
>       </li>
>     </ul>
>   </div>
>   <div class="fall">
>      (etc.)
>   </div>
> </div> <!-- end of "cell" div-->
>
> With the jQuery line:
>    $(this).parents(".cell").load("ajaxpage.php");
> I can have jQuery load ajaxpage.php into the outside <div> that is  
> surrounding THAT PARTICULAR LINK (<a>) that triggered the call.  I  
> don't need to specify that cell by any ID.
>
> *My setup is diffferent than the LAJAX sample, which loads results  
> into a DIFFERENT div.  Mine reload into their same divs.
> **DOM in layperson's terms are the base html elements: <html>,  
> <body>, <p>, <div>, <span>, <a>,  <ul>, <li>, etc.
>
> Granted, it's taken me a little time to understand how jQuery  
> works, but it is really cool... and I'm only just beginning.
>
> Hope that's helpful,
> -Joel
>
>
> On Oct 2, 2007, at 4:49 AM, Gjermund Gusland Thorsen wrote:
>
>> I use LAJAX( http://www.fm-synergy.com/page1/page1.php )
>>
>> I have not really looked at any of the other implementations...
>>
>> Are there anyone who compared them before you started?
>>
>> ggt667
>>
>> On 10/2/07, Steve Winter <steve at bluecrocodile.co.nz> wrote:
>>> Prototype - http://www.prototypejs.org/
>>>
>>> Cheers
>>> Steve
>>>
>>> -----Original Message-----
>>> From: fx.php_list-bounces at mail.iviking.org
>>> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of  
>>> Gjermund Gusland
>>> Thorsen
>>> Sent: Tuesday, 2 October 2007 8:54 a.m.
>>> To: FX.php Discussion List
>>> Subject: [FX.php List] [Poll] Which ajax implementation do you use?
>>>
>>> Which ajax implementation do you use?
>>>
>>> The subject says it all.
>>>
>>> ggt667
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.5.488 / Virus Database: 269.13.37/1042 - Release Date:  
>>> 1/10/2007
>>> 6:59 p.m.
>>>
>>>
>>> No virus found in this outgoing message.
>>> Checked by AVG Free Edition.
>>> Version: 7.5.488 / Virus Database: 269.13.37/1042 - Release Date:  
>>> 1/10/2007
>>> 6:59 p.m.
>>>
>>>
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20071004/fa6388c3/attachment-0001.html


More information about the FX.php_List mailing list