1

我的疑问是如果我有

这些div标签使用jquery使用过渡效果隐藏我想在结果中获得div 1 2 3的结果

1 div
  <div id="1">    
   </div>      
2 div
   <div id="2">
    </div>       
3 div
   <div id="3">
   </div>
   <input type="submit" name="first-sudmit" value="NEXT" onclick="result(this.value)" />
    </div>
    <div id="result">   
        result    
    </div>

在js中:

<script type="text/javascript">
function showResult()    
{
    alert("dfadsfdasf");
    xmlhttp.open("GET","result.php?q="+str,true);
    xmlhttp.send();
}
</script>

我什至也尝试过序列化.....没有运行php脚本

喜欢

js:

<script type="text/javascript">     
function showFormData(oForm) {
   var msg = "The data that you entered for the form with 'name' attribute='" + oForm.name + "': \n";

  submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('result.php', $("#submit_drop,#submit_radio,#submit_check,#submit_text,#submit_drag_text,#submit_drag_img").serialize(), function(data) {
                 $('#results').html(data);
            });           
   alert(msg);
}  
</script>

php:

   //page1 process
    if(!ekpty($_POST['first-submit']))
    {
        $first1=$_POST['drop1'];
        $first2=$_POST['drop2'];
        $first3=$_POST['drop3'];
        $first4=$_POST['drop4'];
        $first5=$_POST['drop5'];
      for(i=0;i<=4;i++)
      {         
          $sql="INSERT INTO $score1(correct)VALUES('$first[i]')";        
      }                
    }
    else
    {
          print '<script type="text/javascript">'; 
          print 'alert("page 1 no answer is attempted")'; 
          print '</script>'; 
    }
//output resu;ts
$sql="SELECT count(chkpt) from score1 where chkpt='1'";    
echo $sql;

那么现在如何在最后一个结果 div 标签中获取这些表单的结果.......

请一些人回答这个......

4

1 回答 1

0

您的问题有点难以阅读,但是如果我理解您的要求,我相信您的序列化代码会起作用,但是我相信您需要使用包含您希望序列化的元素的表单的 ID。所以:

1 div
  <div id="1">
     <form id="firstFormToSubmit">......</form>
   </div>      
2 div
   <div id="2">
     <form id="secondFormToSubmit">......</form>
    </div>       
3 div
   <div id="3">
    <form id="thirdFormToSubmit">......</form>
   </div>
   <input type="submit" name="first-sudmit" value="NEXT" onclick="result(this.value)" />
    </div>
    <div id="result">   
        result    
    </div>

然后处理这些表格:

submitHandler: function(form) {
            // do other stuff for a valid form
            $.post('result.php', $("#firstFormToSubmit").serialize(), function(data) {
             $('#results').html(data);
        });
于 2012-10-05T13:22:10.523 回答