从服务器动态刷新DIV或其他控件 [英] Dynamically Refreshing a DIV or other control from the Server

查看:54
本文介绍了从服务器动态刷新DIV或其他控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找,但显然没有正确地对待我的搜索,所以我是

会在此期间提出一个问题...


我想知道如何在不刷新页面的情况下刷新控件的内容(例如,一个

选择器)。例如,如果我有这些选择:


公司:<选择公司>

联系人:<选择联系人>


当他们选择公司时,我想根据为该公司工作的

重新填写联系人选择器,但我不想刷新表格由于

记录尚未保存。


我知道我可以使用隐藏的表单或某些嵌入式组件来执行HTTP

pull,但我们有一个现场支持应用程序,我们使用它似乎可能

保持与服务器的连接打开,直到它从

浏览器,所以我很好奇,如果那是可行的,资源有多大,那就是
。我们偶尔只会遇到需要做这种事情的事情,但在这种情况下它可能是值得的。我一直在实时支持代码中查看

以了解他们如何进行刷新,但是

我是PHP的新手并且我没有还没有找到答案。


提前谢谢...

I''ve been searching, but apparently not phrasing my search right, so I''m
going to float a question out here in the meantime...

I''m wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page. For example, if I have these selects:

Company: <pick a company>
Contact: <pick a contact>

When they pick the company, I''d like to refill the contact selector based on
who works for that company, but I don''t want to refresh the form since the
record hasn''t been saved yet.

I know I could use a hidden form or some embedded component to do an HTTP
pull, but we have a live support app that we use and it seems like it might
be keeping the connection to the server open until it''s unloaded from the
browser, so I was curious if that''s doable, and how big a resource hog it
is. We''ll only have occasional instances where we''d need to do this sort of
thing, but in those cases it would probably be worth it. I''ve been poking
around in the live support code to find out how they do their refreshes, but
I''m kind of new to PHP and I haven''t spotted the answer yet.

Thanks in advance...

推荐答案

在星期四, 2003年9月25日15:18:28 -0400,Philo Del Middleston

< bi ******* @ sobranisoft.com>写道:
On Thu, 25 Sep 2003 15:18:28 -0400, "Philo Del Middleston"
<bi*******@sobranisoft.com> wrote:
我一直在寻找,但显然没有对我的搜索进行正确的判断,所以我在此期间要在这里提出一个问题。 。

我想知道如何在不刷新页面的情况下刷新控件的内容(例如,
选择器)。
I''ve been searching, but apparently not phrasing my search right, so I''m
going to float a question out here in the meantime...

I''m wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page.



Javascript。


-

Andy Hassall(an**@andyh.co.uk)icq(5747695)( http://www.andyh.co.uk

Space :磁盘使用情况分析工具( http://www.andyhsoftware.co.uk/space



Javascript.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


显然我必须使用Javascript作为客户端部分...


问题是关于如何服务器拉取来获取新数据。我们

有一些客户端拥有非常大的数据库 - 我不想拉下

整个联系人表,这样我就可以刷新选择器了/>
更改。

" Andy Hassall" <一个** @ andyh.co.uk>在留言中写道

新闻:h7 ******************************** @ 4ax.com ...
Clearly I have to use Javascript for the client piece...

The question is about how to do the server pull to get the fresh data. We
have some clients with very large databases - I don''t want to pull down the
entire contacts table just so I can refresh the selector if the company
changes.
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:h7********************************@4ax.com...
2003年9月25日星期四15:18:28 -0400,Philo Del Middleston
< bi ******* @ sobranisoft.com>写道:
On Thu, 25 Sep 2003 15:18:28 -0400, "Philo Del Middleston"
<bi*******@sobranisoft.com> wrote:
我一直在寻找,但显然没有对我的搜索进行正确的判断,所以我在此期间要在这里提出一个问题。 。

我想知道如何在不刷新页面的情况下刷新控件的内容(例如,
选择器)。
I''ve been searching, but apparently not phrasing my search right, so I''m
going to float a question out here in the meantime...

I''m wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page.


Javascript。

-
Andy Hassall(an**@andyh.co.uk)icq(5747695)( http://www.andyh.co.uk
空间:磁盘使用情况分析工具( http://www.andyhsoftware.co.uk/space



Javascript.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)



Philo Del Middleston写道:
Philo Del Middleston wrote:
我一直在寻找,但显然没有正确地搜索我的搜索,所以我要去同时在这里提出一个问题...

我想知道如何改善续约控件(例如,
选择器)的内容,而不刷新页面。例如,如果我有这些选择:

公司:<选择公司>
联系人:<选择联系人>

当他们选择公司时,我想重新填写基于
为该公司工作的联系人选择器,但我不想刷新表格,因为
记录还没有保存。

我知道我可以使用隐藏的表单或某些嵌入式组件进行HTTP
拉动,但是我们有一个我们使用的实时支持应用程序,它似乎可能是
保持与服务器的连接打开,直到它从
浏览器中卸载,所以我很好奇这是否可行,以及它有多大的资源。我们偶尔只会遇到需要做这种事情的事情,但在这种情况下它可能是值得的。我一直在实时支持代码中寻找他们如何刷新,但是我是PHP的新手,我还没有发现答案。

提前致谢...
I''ve been searching, but apparently not phrasing my search right, so I''m
going to float a question out here in the meantime...

I''m wondering how to go about refreshing the content of a control (say, a
selector) without refreshing the page. For example, if I have these selects:

Company: <pick a company>
Contact: <pick a contact>

When they pick the company, I''d like to refill the contact selector based on
who works for that company, but I don''t want to refresh the form since the
record hasn''t been saved yet.

I know I could use a hidden form or some embedded component to do an HTTP
pull, but we have a live support app that we use and it seems like it might
be keeping the connection to the server open until it''s unloaded from the
browser, so I was curious if that''s doable, and how big a resource hog it
is. We''ll only have occasional instances where we''d need to do this sort of
thing, but in those cases it would probably be worth it. I''ve been poking
around in the live support code to find out how they do their refreshes, but
I''m kind of new to PHP and I haven''t spotted the answer yet.

Thanks in advance...




对我来说听起来有点混乱。你想要的是让

为一个SELECT元素的onChange事件,以显示基于

该选项值的信息。这听起来你需要为每个选项至少提出一个

HTTP /数据库请求 - 或者每次更改
。我建议使用iframe元素,然后在onChange javascript

方法中,简单地将IFRMAE视为命名窗口(类似于

framesets),然后重新加载这样的内容。


但是,我认为您对实时支持应用程序和开放服务器

连接的评论令我感到困惑。如果您想在记录表单中的数据之前不再发出后续

请求,则必须找到

所有可能的选择并保存内容那些地方

(很可能带有隐藏元素)并在选择了这个选项时将它们显示为

。但是,根据用户选择的内容,请求

数据似乎更有效率,因为他们不太可能通过每个选项获得
(或者是吗?)。


-

Justin Koivisto - sp ** @ koivi.com

PHP海报:请使用comp.lang.php获取与PHP相关的问题,

alt.php *不推荐使用。



Sounds a little confusing to me. What it sounds like you want is to make
an onChange event for a SELECT element to display information based on
that option''s value. This sounds like you will need to make at least one
HTTP/database request for each of the options - or for each time it''s
changed. I''d suggest an iframe element, then in the onChange javascript
method, simply treat the IFRMAE as a named window (similar to in
framesets), and reload its content that way.

However, I think your comments about live support app and open server
connections are confusing me. If you want to make no more subsequent
requests until the data from the form is recorded, you''ll have to find
all the possible choices and save the content for those somewhere
(likely with hidden elements) and make them visible when that option was
chosen. However, it would seem to be much more efficient to request the
data according to what the user chose since they aren''t likely to go
through every option (or are they?).

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.


这篇关于从服务器动态刷新DIV或其他控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆