在提交形式表单时,比如前台是<代码> $(“形式”)。submit() 代码>同步提交的时候,这个是没有回掉函数的,那么我们只能在后台提示,在前台显示,自己作为一个参考吧
公共类脚本 { 公共静态失效警报(字符串消息) { ResponseScript(“警报(“+信息+”);窗口。位置='弹出提示语后,点击确认跳到你想跳的页面”;“); } 公共静态孔隙ResponseScript (string脚本) { HttpContext.Current.Response.Write (“& lt;脚本类型=\ " text/javascript \“祝辞\ n//& lt; ! [CDATA [\ n”); HttpContext.Current.Response.Write(脚本); HttpContext.Current.Response.Write (“\ n//]]祝辞\ n \ n”); } }
还有就是将一般处理程序默认的<代码>//context.Response。ContentType=" text/plain”> 代码;改为
,,,,,,,,,,<代码> context.Response。ContentType=" text/html "> 代码;
我们调用的时候直接:,
Script.Alert(“你的提示语!”);
. ajax({美元 类型:“文章”, url:“/工具/ActApply.ashx”, 数据:“txthdmoney=" + .trim美元($ (" # hdmoneyx ") [0] value) +“和sxf=2”, 成功:函数(结果){ } });
.ashx后台接收数据
十进制hdmoney保护; 十进制hdsxf保护;///& lt; summary>///请求处理///& lt;/summary>///& lt;参数name=吧舷挛摹弊4? lt;/param> 公共空间ProcessRequest (HttpContext上下文) { 撤军withdra=new撤军(); context.Response。ContentType=" text/plain”; hdmoney=Convert.ToDecimal (context.Request.Params (“txthdmoney”) .ToString ()); hdsxf=Convert.ToDecimal (context.Request.Params (“sxf”) .ToString ()); SaveAct (); } 公共bool IsReusable { 得到 { 返回错误; } }
以上所述是小编给大家介绍的在一般处理程序(ashx)中弹出js提示语,希望对大家有所帮助,如果大家有任何疑问请给我留的言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!