将URL内容加载到变量中 [英] Loading URL contents into a variable

查看:84
本文介绍了将URL内容加载到变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将从URL返回的内容加载到

JavaScript变量中?假设用户从弹出列表中选择一个选项。

我想在URL中将该选项传递给在数据库上运行

查询的服务器上的脚本。该值从URL返回,并且在JavaScript变量中填充了

。类似于:


函数LookupFunc(TestString)

{

TheResult = script.loadValueFrom =

http://dbserver/LookupScript.php?TheValue =" + TestString;


alert(TheResult);

}


目标是我可以查找值 ;在飞行中而不是试图

提供适当的选择。

__

Scott Orsburn

Kaomso
www.kaomso.com


我''我不够聪明,想到一个很酷的签名。

Is there a way to load the contents returned from a URL into a
JavaScript variable? Suppose a user picks an option from a popup list.
I want to pass that choice in a URL to a script on a server that runs a
query on a database. The value is returned from the URL and is
populated in a JavaScript variable. Something like:

function LookupFunc(TestString)
{
TheResult = script.loadValueFrom =
"http://dbserver/LookupScript.php?TheValue=" + TestString;

alert(TheResult);
}

The goal is that I can lookup values "on the fly" rather than trying to
accommodate the choices before hand.
__
Scott Orsburn
Kaomso
www.kaomso.com

I''m not clever enough to think of a cool signature.

推荐答案

2004年11月24日星期三08:47:36 -0500, Scott Orsburn

< scottso_no@spam_maclaunch.com>写道:
On Wed, 24 Nov 2004 08:47:36 -0500, Scott Orsburn
<scottso_no@spam_maclaunch.com> wrote:
有没有办法将从URL返回的内容加载到一个
JavaScript变量?


请参阅常见问题解答(< URL:http://jibbering.com/faq/>)。


[snip] < br $>
__
Is there a way to load the contents returned from a URL into a
JavaScript variable?
See the FAQ (<URL:http://jibbering.com/faq/>).

[snip]
__




Usenet上的约定是签名开始破折号空格( - )。

这有助于新闻阅读者识别和格式化签名,并在用户选择回复时自动删除它们。


[snip]


迈克


-

Michael Winter

替换.invalid与.uk通过电子邮件回复。



The convention on Usenet is that signatures begin dash-dash-space (-- ).
This helps news readers identify and format signatures, and remove them
automatically when a user selects "Reply".

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.





Scott Orsburn写道:


Scott Orsburn wrote:
有没有办法将从URL返回的内容加载到
JavaScript变量中?假设用户从弹出列表中选择一个选项。
我想在URL中将该选项传递给在数据库上运行
查询的服务器上的脚本。该值从URL返回,并在JavaScript变量中填充。类似于:

函数LookupFunc(TestString)
{Result = script.loadValueFrom =
" http://dbserver/LookupScript.php?TheValue =" ; + TestString;
alert(TheResult);
}

目标是我可以在运行中查找值。而不是试图接受手头的选择。
Is there a way to load the contents returned from a URL into a
JavaScript variable? Suppose a user picks an option from a popup list.
I want to pass that choice in a URL to a script on a server that runs a
query on a database. The value is returned from the URL and is
populated in a JavaScript variable. Something like:

function LookupFunc(TestString)
{
TheResult = script.loadValueFrom =
"http://dbserver/LookupScript.php?TheValue=" + TestString;
alert(TheResult);
}

The goal is that I can lookup values "on the fly" rather than trying to
accommodate the choices before hand.




随着越来越多的浏览器(IE5 + / Win,Netscape 6/7,Mozilla,

Firefox,Safari 1.2,Opera 7.6x,当它出来时)你可以做到这一点,

但是这些接口适合发送和接收XML。并且

当然,异步加载可能是有意义的,因此您需要设置一个

事件处理程序来处理接收的数据。


http:// www。 faqts.com/knowledge_base/.../17226/fid/616


http://jibbering.com/2002/4/httprequest.html


对于IE / Win那里也是这里描述的下载行为:
http://www.faqts.com/knowledge_base/...d/1268/fid/126


-

Martin Honnen
http://JavaScript.FAQTs.com/



With a growing range of browsers (IE5+/Win, Netscape 6/7, Mozilla,
Firefox, Safari 1.2, Opera 7.6x when it comes out) you can do that,
however the interfaces are geared towards sending and receiving XML. And
of course it might make sense to load asynchronously so you will need an
event handler set up to handle the received data.
See
http://www.faqts.com/knowledge_base/.../17226/fid/616
and
http://jibbering.com/2002/4/httprequest.html

For IE/Win there is also the download behaviour as described here:
http://www.faqts.com/knowledge_base/...d/1268/fid/126

--

Martin Honnen
http://JavaScript.FAQTs.com/


迈克,


谢谢你的主动提供的建议关于Usenet约定。如果我

可能会提供我自己的一些?将海报引用到模糊的URL并不是很有帮助。从站点指向相关文档很有帮助。如果我想要一个通用的JavaScript资源网站,我可以自己找到它们。

Michael Winter写道:
Mike,

thank you for your unsolicited advise about Usenet convention. If I
might offer some of my own? Referring a poster to a vague URL is not
helpful. Pointing to a relevant document from a site is helpful. If I
wanted a generic JavaScript resource site I can find those on my own.
Michael Winter wrote:
周三,2004年11月24日08:47:36 -0500,Scott Orsburn
< scottso_no@spam_maclaunch.com>写道:
On Wed, 24 Nov 2004 08:47:36 -0500, Scott Orsburn
<scottso_no@spam_maclaunch.com> wrote:
有没有办法将从URL返回的内容加载到
JavaScript变量?
Is there a way to load the contents returned from a URL into a
JavaScript variable?



请参阅常见问题解答(< URL:http://jibbering.com/faq/>)。

[snip]


See the FAQ (<URL:http://jibbering.com/faq/>).

[snip]

__


Usenet上的约定是签名开始破折号空间( -
)。这有助于新闻阅读者识别和格式化签名,并在用户选择回复时自动删除签名。

[snip]

Mike


The convention on Usenet is that signatures begin dash-dash-space (--
). This helps news readers identify and format signatures, and remove
them automatically when a user selects "Reply".

[snip]

Mike



这篇关于将URL内容加载到变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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