带有AJAX内容的Webforms [英] Webforms with AJAX Content

查看:47
本文介绍了带有AJAX内容的Webforms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Default.aspx中,我通过AJAX加载内容以保持音乐播放器的运行(我知道,我知道,不要在网页上播放音乐这是音乐网站,所以这就是重点)。我搞砸了iFrames,但是他们很快就变丑了。



下面的代码用我的其他页面填充DIV。这些其他页面中包含需要处理各种方法的表单。在我的测试中,我无法正确提交表单。



1.如果我没有指定表单操作,表单提交给自己,这很好,但是它会重新加载,将它从DIV中分解并放入它自己的页面。



2.如果我指定这样的表单动作......
action =javascript:ajaxpage('page1.aspx','content')

...然后它根本不会提交。



如何在不丢失父容器的情况下让子页面提交表单数据?



奖金问题,如何更改网址以反映孩子而不是父母?



In my Default.aspx, I am loading the content via AJAX to keep a music player running (I know, I know, "don't play music in web pages" This is music site though, so that is the point.). I messed with iFrames, but they get ugly really quickly.

The code below fills the DIV with my other pages. These other pages have forms in them that need to process various methods. In my test, I cannot get the form to submit correctly.

1. If I do not specify a form action, the form submits to itself, which is fine, but it reloads, breaking it out of the DIV and putting it in it's own page.

2. If I specify the form action like this...
action="javascript:ajaxpage('page1.aspx', 'content')"
...then it won't submit at all.

How do I get the "child pages" to submit form data without losing the parent container?

Bonus question, how can I change the URLs to reflect the child instead of the parent?

<a href="javascript:ajaxpage('page1.aspx', 'content');">Page 1</a>
<a href="javascript:ajaxpage('page2.aspx', 'content');">Page 2</a>

<div id='content'>Home</div>
<script src='/scripts/atr_script.js'></script>

推荐答案

这篇关于带有AJAX内容的Webforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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