Hwo显示警告消息并在ASP VB中刷新页面。 (服务器端代码) [英] Hwo to show alert message and refresh the page in ASP VB. (SERVER SIDE CODE)

查看:58
本文介绍了Hwo显示警告消息并在ASP VB中刷新页面。 (服务器端代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,我如何显示弹出提醒并刷新页面后。



我尝试过的方法:



但这里什么也没发生



 Dim stringBuilder As New System.Text.StringBuilder( < script+type ='text / javascript'>)
stringBuilder.Append(alert('学生记录成功更新');)
stringBuilder.Append(window。 location.reload();)
stringBuilder.Append(< / script>)

解决方案

你有与页面一起发送该代码。如果没有客户端请求,您不能随意向客户端发送任何内容。这包括只发送一个脚本片段。没有来自浏览器的请求就没有推送内容。



必须加载Thage页面中已经存在的脚本等待执行。您必须对服务器进行一些AJAX调用才能让它进行处理并返回完成消息或您选择的代码。然后,您的客户端javascript代码必须查看该代码并确定它是否应该显示警报消息。



无法仅执行此操作服务器端代码。


hey guys how do i show an pop up alert and refresh the page after it.

What I have tried:

but nothing happens here

Dim stringBuilder As New System.Text.StringBuilder("<script " + "type='text/javascript'>")
        stringBuilder.Append("alert('Student record Succesfully updated');")
        stringBuilder.Append("window.location.reload();")
        stringBuilder.Append("</script>")

解决方案

You have to send that code with the page. You cannot just arbitrarily send anything to a client without the client requesting it. That includes just sending a script snippet. There is no such thing as "pushing" content without a request from the browser.

Thage page would have to be loaded with the script already in it waiting to be executed. You'd have to make some AJAX call to the server to get it to do it's processing and return a completion message or code of your choosing. Your client side javascript code would then have to look at that code and determine if it should show the alert message or not.

There is no way to do this from only server-side code.


这篇关于Hwo显示警告消息并在ASP VB中刷新页面。 (服务器端代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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