Google 網上論壇首頁
說明 | 登入
How To Load Divs Asynchronous For Index.php?
目前本群組有太多主題設為優先顯示。 要優先顯示這個主題,請將其他主題的這個選項取消。
在處理您的要求時發生錯誤。 請再試一次。
標幟
  12 個訊息 - 全部摺疊
您要留言的群組是 Usenet 群組。在此群組留言,網際網路上的任何使用者將可以看到您的電郵地址。
您的回覆郵件尚未寄出。
您已成功留言
Eric  
檢視個人資料
 更多選項 2006年10月29日, 下午9時32分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Sun, 29 Oct 2006 13:32:32 -0000
當地時間: 2006年10月29日(星期日) 下午9時32分
主旨: How To Load Divs Asynchronous For Index.php?
Hi,

Can anyone who help me to figure out the following questions?

A.    Like the subject said. Normally when u loading a new page like
index.php, all the elements or DIVs are loading simultaneously. How Can
I make all the DIVs asynchronous or one by one?

B.    How Can I reload or refresh a single DIV by clicking?

Thanks


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Ismael S. Kafeltz  
檢視個人資料
 更多選項 2006年10月30日, 上午12時20分
寄件者: "Ismael S. Kafeltz" <Shala...@gmail.com>
日期: Sun, 29 Oct 2006 08:20:50 -0800
當地時間: 2006年10月30日(星期一) 上午12時20分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Take a look in this source code, it is easy to understand:

http://www.grahambird.co.uk/cake/tutorials/ajax.php


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年10月30日, 上午9時24分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Sun, 29 Oct 2006 17:24:12 -0800
當地時間: 2006年10月30日(星期一) 上午9時24分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Thanks. I think it slove the question B. To click "todo" to load the
"todo" tasks.

BUT, I think it is not my goal for A.
How the Divs, for instance, three Divs, to load indivially?
Like the www.netvibes.com. Each elements are loading according their
speed or asynchronous.

Should I creat a new controller ,modify the controller or modify the
.thtml files to do this ?


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Tim  
檢視個人資料
 更多選項 2006年10月30日, 下午7時13分
寄件者: "Tim" <tdi...@gmail.com>
日期: Mon, 30 Oct 2006 11:13:14 -0000
當地時間: 2006年10月30日(星期一) 下午7時13分
主旨: Re: How To Load Divs Asynchronous For Index.php?
If I understand your problem correctly you may just want to make each
div synchronous.

$options ['type']         // Either 'asynchronous' (default), or
'synchronous'.


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年10月30日, 下午8時53分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Mon, 30 Oct 2006 04:53:05 -0800
當地時間: 2006年10月30日(星期一) 下午8時53分
主旨: Re: How To Load Divs Asynchronous For Index.php?
I am not so clear. The div synchronous means each div are loading at
the same time. Is it correct?

BUT for the example website www.netvibes.com, is it the each div are
loading asynchronous or indivually?

AND also, if I want to load the index page to load like
www.netvibes.com, Where can I write the code like u $options['type'].

Thanks. I am a rookie.


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年10月30日, 下午8時56分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Mon, 30 Oct 2006 04:56:53 -0800
當地時間: 2006年10月30日(星期一) 下午8時56分
主旨: Re: How To Load Divs Asynchronous For Index.php?
For the Question B.
I check the script.aculo.us Wiki and got one solution.
use Ajax.Updater for onclick

The code below:
onclick="new
Ajax.Updater('posts_view','/posts/refresh',{asynchronous:true,evalScritps:t rue});return
false"

Is it the right way to do this even it works?

Thanks.


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Tim  
檢視個人資料
(1 位使用者)  更多選項 2006年10月31日, 上午7時47分
寄件者: "Tim" <tdi...@gmail.com>
日期: Mon, 30 Oct 2006 23:47:19 -0000
當地時間: 2006年10月31日(星期二) 上午7時47分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Hi Eric,
I think you might be getting your synchronous and asynchronous in a
muddle.

Synchronous -> browser stops working and waits for reply from a single
request
Asynchronous -> browser makes multiple requests at the same time...!

See:  http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request

Most people seem to think that synchronous requests are a bad idea
e.g. http://ajaxblog.com/archives/2005/05/25/synchronous-requests-bad
https://blueprints.dev.java.net/ajax-faq.html#synchronous

On Oct 30, 12:56 pm, "Eric" <xeboy2...@yahoo.com.cn> wrote:


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Tim  
檢視個人資料
(1 位使用者)  更多選項 2006年10月31日, 上午8時05分
寄件者: "Tim" <tdi...@gmail.com>
日期: Tue, 31 Oct 2006 00:05:54 -0000
當地時間: 2006年10月31日(星期二) 上午8時05分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Hi Eric

If you look back again at Graham Bird's 'tutorial', in the view you'll
see an example of the $option['update'] option, I agree it's difficult
know from the documentation that you are supposed to remove the $option
and stick it in an array....

        print $ajax->link('Delete', 'delete/' . $item['id'],
array('update'=>'tasks_done'));

If you want to do it on load of the page you'll probably need an onload
event attached to the body tag.

This should call a function which (if you want to have it cakeified)
should maybe have one blocks of code for each div you want to update:

                        echo $ajax->remoteFunction(
                        array("url"=>"/controller/action/",
                                  "update"=>"divToUpdate",
                                  "type"=>"asynchronous"
                                  )
                        );

View the source after its run and you'll see it converts it to use the
prototype.js object Ajax.Updater

If you change the type to synchronous, each div should load one after
the other, rather than all at once.
Hope this helps

Tim


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年10月31日, 下午8時45分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Tue, 31 Oct 2006 04:45:04 -0800
當地時間: 2006年10月31日(星期二) 下午8時45分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Thanks.

I am getting clear about 'S 'and 'A'.

I think I should add a event-onload to the body tag, to do it when the
page is loading and let the divs to load Asynchronous.

I chech the remoteFunction:
Creates JavaScript function for remote AJAX call.

This function creates the javascript needed to make a remote call it is
primarily used as a helper for linkToRemote.

I am not so clear about the defination. For remote AJAX call?
I have an idea just add an onload event using Ajax.Updater in the body
tag. Like u said it converts it to use the Ajax.Updater.

Is it the same function?  Just another name in Cakephp rather than
called Ajax.Updater in prototype?

Thanks.


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年10月31日, 下午10時26分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Tue, 31 Oct 2006 06:26:00 -0800
主旨: Re: How To Load Divs Asynchronous For Index.php?
Is the Right code for body Tag ?  But I am not clear about what is the
'window' and 'load' . Is the part of onload event or what ? I can't
find any refrence.

<body onload="<?=$ajax->javascript->event('window','load',
$ajax->remoteFunction(
            array("url"=>"/posts/load/",
                                  "update"=>"posts_view",
                                  "type"=>"asynchronous"
                    )

                      ) ); ">


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Tim  
檢視個人資料
(1 位使用者)  更多選項 2006年11月1日, 上午5時26分
寄件者: "Tim" <tdi...@gmail.com>
日期: Tue, 31 Oct 2006 21:26:32 -0000
當地時間: 2006年11月1日(星期三) 上午5時26分
主旨: Re: How To Load Divs Asynchronous For Index.php?
Hi Zou,

>  Is the Right code for body Tag ?

No, I don't think this will work as it stands.

>  But I am not clear about what is the 'window' and 'load'.

The Window object is the highest level js object which corresponds
to the web browser window.  The 'load' is the argument that you are
passing into
the 'event' function,  corresponding to the type of event you are
attaching to.  If you want an
onclick event, you pass in 'click', for onblur->'blur' etc.  The
function
prepends it with 'on' depending on the type of browser that you have.

>  Is the part of onload event or what ? I can't find any refrence.

Hmm.  If you want to do it this way (there are a few ways to do this)
then the
body tag could just stay like this:

<body>

In your <head> (maybe) you should have a script tag or a call to a .js
with the following:

<script type="text/javascript">

// attach the event to the body tag and attach the doAjaxCall() to the
event
$javascript->event('window','load', 'doAjaxCall()', false);

function doAjaxCall () {
        $ajax->remoteFunction(array("url"=>"/posts/load/","update"=>"posts_view","t ype"=>"asynchronous"));

}

</script>

I haven't tested this, so you'll probably need to play with it to get
it to work.
Hope this helps...

Cheers


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Eric  
檢視個人資料
 更多選項 2006年11月1日, 上午10時50分
寄件者: "Eric" <xeboy2...@yahoo.com.cn>
日期: Tue, 31 Oct 2006 18:50:46 -0800
當地時間: 2006年11月1日(星期三) 上午10時50分
主旨: Re: How To Load Divs Asynchronous For Index.php?
I put the code below between head. It works!
For the function doAjaxCall( ), I really don't know where should I put.
So, I just combine the two parts together. Now, I know the logic to do
it.

Thanks.Tim
Have a good Day!!

<head>
<?php print
$javascript->event('window','load',$ajax->remoteFunction(array("url"=>"/pos ts/index/","update"=>"posts_view","type"=>"asynchronous")),false)?>
</head>


    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
主題尾端
« 返回討論主題 « 較新的主題     較舊的主題 »

建立群組 - Google 網上論壇 - Google 首頁 - 服務條款 - 隱私權政策
©2008 Google