Orionhunter Posted April 20, 2006 Share Posted April 20, 2006 Hi!I'm new to AJAX and I'm trying to make something like this:- I have a multiple select list in my page with some options, and when I choose one of the options, I make a request via AJAX (to a PHP script) to retrieve me some data.- This retrieved data will be used to fill a second <SELECT> with some new options.Everything works fine and the the second list is created dinamically just like I wanted to.The problem is that when I press the submit button of the form, only the 1st list is sent through, and the new (2nd) list which was created on the fly, doesn't appear anywhere...not even in the source code.Just to get an idea, I'm placing the AJAX's response inside a DIV tag, via innerHTML....something like this:foo.html: <script LANGUAGE='JavaScript'> function treatAjaxResponse() { document.getElementById('ajax_result').innerHTML = ajax.responseText; }</SCRIPT>.....<FORM ACTION='script.php' METHOD='POST'><SELECT NAME='content1' ID='firstList' MULTIPLE> <OPTION>...</OPTION> ....</SELECT><DIV ID='ajax_result'> <! -- (Ajax's result code - the second SELECT list - goes here) --></DIV></FORM> script.php has something like this: <?php$output = "<SELECT NAME='content2' ID='secondList' MULTIPLE>";if(some_condition){ $output .= "<OPTION VALUE='test'> Test </OPTION>";}else{ ...}$output .= "</SELECT>";print $output;?> So...how can I make the contents of the secondList to go through the FORM, so that I can know what option did the user selected??Thanks in advance,Orionhunter Link to comment Share on other sites More sharing options...
Orionhunter Posted April 20, 2006 Author Share Posted April 20, 2006 Ok, I fixed it...I had to change my DOCTYPE! I was using Transitional, and I had to use Frameset ('cause I'm using IFRAMES).Now I can see the 2nd list data. Link to comment Share on other sites More sharing options...
aspnetguy Posted April 21, 2006 Share Posted April 21, 2006 Ok, I fixed it...I had to change my DOCTYPE! I was using Transitional, and I had to use Frameset ('cause I'm using IFRAMES).Now I can see the 2nd list data. <{POST_SNAPBACK}> You do not need FRAMESET for IFRAMES only when using FRAMESET anf FRAMES.You find that that will not validate Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now