发布到服务器但保持在同一页面上 [英] posting to server but staying on same page

查看:65
本文介绍了发布到服务器但保持在同一页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个问题而且不太明白如何解决它。


我有一个用asp编写的表格。我希望提交表格并让服务器

返回同一页面而不实际刷新页面。


我知道我可以写一个表格,提交它并转到另一页。


我在网上搜索过,我看到一些关于HTTP状态代码204的信息

将不返回任何内容客户端浏览器。我如何将这个

合并到我的asp页面中?如何在asp中检测HTTP状态代码?


有更好的方法吗?


谢谢,


解决方案

好吧,如果您提交表单,页面将不得不刷新。您可以尝试

类似于:

<%

功能自我()

Dim sPath,aParts

sPath = Request.ServerVariables(" SCRIPT_NAME")

aParts = Split(" /"& sPath," /")

Self = Trim(LCase(aParts(UBound(aParts))))

结束功能

%>


<%

如果Request.ServerVariables(" REQUEST_METHOD")=" POST"然后

'''''其他检查帖子的方法,如If Request.Form(" hiddeninput")<>

""那么......

'''''你的代码在这里

结束如果

%>


< form method =" post" action ="<%= Self()%>">


-


雷在家

Microsoft ASP MVP

" wk6pack" <周*** @ sd61.bc.ca>在消息中写道

news:uH ************** @ TK2MSFTNGP12.phx.gbl ...


我有一个问题,而不是如何解决它。

我有一个用asp编写的表单。我希望提交表单并让
服务器返回到同一页面而不实际刷新页面。

我知道我可以写一个表单,提交它并转到另一个页面。

我在网上搜索过,我发现一些关于HTTP状态代码的内容将不会向客户端浏览器返回任何内容。我如何将
加入到我的asp页面中?如何在asp中检测HTTP状态代码?

有更好的方法吗?

谢谢,



" wk6pack" <周*** @ sd61.bc.ca>在消息中写道

news:uH ************** @ TK2MSFTNGP12.phx.gbl ...


我有一个问题,而不是如何解决它。

我有一个用asp编写的表单。我希望提交表单并让
服务器返回到同一页面而不实际刷新页面。

我知道我可以写一个表单,提交它并转到另一个页面。

我在网上搜索过,我发现一些关于HTTP状态代码的内容将不会向客户端浏览器返回任何内容。我如何将
加入到我的asp页面中?如何在asp中检测HTTP状态代码?

有更好的方法吗?




老实说,你会更好关闭刷新页面,如果没有更好的原因而不是与网络的其余部分保持一致。如果用户

点击一个按钮提交,他们没有看到他们的浏览器做任何事情,

我想大多数人都会认为出了问题并且

开始一遍又一遍地点击提交或者返回前进尝试

找出浏览器停止工作的原因。

为什么不这样做:

用户将表单提交到进行处理的页面,但不会显示任何内容。在处理结束时,Response.Redirect返回到上一页的
,因此用户最终会在同一页面上,但是他们会看到一些动作让我们看到他们知道发生了什么事。


问候,

彼得福蒂



< blockquote>嗨彼得,


这是我的初衷。用户更喜欢不做任何事情。

因为你需要提交表格,我正在尝试提交表格然后

有下一个表格要么重定向返回或使用元标记自动

将原始页面带回来。


我提交的表单需要上一页的值。这些

值然后创建一个sql语句并填充页面。当我将

表单提交给另一个asp在服务器上进行处理时,我会回到

提交的表单但它似乎没有记住任何这个页面上的值

即使我将它们隐藏在返回的

的asp页面上。


有什么想法吗?


谢谢,



" Peter Foti" < PE *** @ Idontwantnostinkingemailfromyou.com>在消息中写道

news:10 ************* @ corp.supernews.com ...

" wk6pack" <周*** @ sd61.bc.ca>在消息中写道
新闻:uH ************** @ TK2MSFTNGP12.phx.gbl ...


我有一个问题,而不是如何去解决它。

我有一个用asp编写的表单。我希望提交表单并让服务器

返回到同一页面而不实际刷新页面。

我知道我可以写一个表单,提交它然后去到了另一页。

我在网上搜索过,我看到一些关于HTTP状态代码的内容将不会向客户端浏览器返回任何内容。我如何将

加入


到我的asp页面?如何在asp中检测HTTP状态代码?

有没有更好的方法呢?



老实说,你最好刷新页面,如果没有更好的理由,而不是与网络的其余部分保持一致。如果用户点击一个按钮提交,并且他们没有看到他们的浏览器正在做什么



,我认为大多数人会认为出了问题
并开始一遍又一遍地点击提交或者返回和转发试图找出浏览器停止工作的原因。
为什么不这样做:
用户将表单提交到执行处理的页面,但不显示任何内容。在处理结束时,Response.Redirect返回到上一页,因此用户最终会在同一页面上,但是他们会看到一些动作让他们知道发生了什么。

问候,
Peter Foti



Hi,

I have a problem and not quite how to go about solving it.

I have a form written in asp. I wish to submit the form and have the server
return back to the same page without actually refreshing the page.

I know I could write a form, submit it and go to another page.

I''ve searched the web and I see something about HTTP Status code of 204
would return no content to the client browser. How would I incorporate this
into my asp page? How do I detect a HTTP status codes in asp?

Is there a better way to do this?

thanks,
Will

解决方案

Well, if you submit the form, the page will have to refresh. You can try
something like:
<%
Function Self()
Dim sPath, aParts
sPath = Request.ServerVariables("SCRIPT_NAME")
aParts = Split("/" & sPath, "/")
Self = Trim(LCase(aParts(UBound(aParts))))
End Function
%>

<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
''''''other ways to check for post, like If Request.Form("hiddeninput") <>
"" Then ...
''''''your code here
End If
%>

<form method="post" action="<%=Self()%>">

--

Ray at home
Microsoft ASP MVP
"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:uH**************@TK2MSFTNGP12.phx.gbl...

Hi,

I have a problem and not quite how to go about solving it.

I have a form written in asp. I wish to submit the form and have the server return back to the same page without actually refreshing the page.

I know I could write a form, submit it and go to another page.

I''ve searched the web and I see something about HTTP Status code of 204
would return no content to the client browser. How would I incorporate this into my asp page? How do I detect a HTTP status codes in asp?

Is there a better way to do this?

thanks,
Will



"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:uH**************@TK2MSFTNGP12.phx.gbl...

Hi,

I have a problem and not quite how to go about solving it.

I have a form written in asp. I wish to submit the form and have the server return back to the same page without actually refreshing the page.

I know I could write a form, submit it and go to another page.

I''ve searched the web and I see something about HTTP Status code of 204
would return no content to the client browser. How would I incorporate this into my asp page? How do I detect a HTTP status codes in asp?

Is there a better way to do this?



Honestly, you will be better off refreshing the page, if for no better
reason than to remain consistent with the rest of the web. If the user
clicks a button to submit, and they don''t see their browser doing anything,
I think most people would come to the assumtion that something was wrong and
start clicking submit over and over or going Back and Forward trying to
figure out why there browser stopped working.

Why not do something like this:
User submits the form to a page that does the processing, but does not
display anything. At the end of the processing, Response.Redirect back to
the previous page, so the user ends up on the same page but they would have
seen some action to let them know something happened.

Regards,
Peter Foti



Hi Peter,

That was my original intention. The users prefer to have that do nothing.
Since you need to submit the form, I''m trying to submit the form and then
have the next form either redirect back or using meta tags to automatically
bring that original page back.

The form that I am submitting, needs values from the previous page. These
values then create a sql statement and populate the page. When I submit the
form to another asp to do the processing on the server, I then come back to
the form that was submitted but it doesnt seem to remember any of the values
on that page even though I have them hidden on the asp page that is
returned.

Any ideas?

thanks,
Will
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message
news:10*************@corp.supernews.com...

"wk6pack" <wk***@sd61.bc.ca> wrote in message
news:uH**************@TK2MSFTNGP12.phx.gbl...

Hi,

I have a problem and not quite how to go about solving it.

I have a form written in asp. I wish to submit the form and have the server

return back to the same page without actually refreshing the page.

I know I could write a form, submit it and go to another page.

I''ve searched the web and I see something about HTTP Status code of 204
would return no content to the client browser. How would I incorporate


this

into my asp page? How do I detect a HTTP status codes in asp?

Is there a better way to do this?



Honestly, you will be better off refreshing the page, if for no better
reason than to remain consistent with the rest of the web. If the user
clicks a button to submit, and they don''t see their browser doing


anything, I think most people would come to the assumtion that something was wrong and start clicking submit over and over or going Back and Forward trying to
figure out why there browser stopped working.

Why not do something like this:
User submits the form to a page that does the processing, but does not
display anything. At the end of the processing, Response.Redirect back to
the previous page, so the user ends up on the same page but they would have seen some action to let them know something happened.

Regards,
Peter Foti



这篇关于发布到服务器但保持在同一页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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