Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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?

XML
<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>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900