回答編集履歴
1
追記
    
        answer	
    CHANGED
    
    | 
         @@ -3,4 +3,38 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            むしろ同じデータをおくるのであればajaxでおくらずにpostするだけでよいのでは?
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            仮にajaxでpostしたあとにページの遷移をするだけなら
         
     | 
| 
       6 
     | 
    
         
            -
            location.hrefでデータを送らない遷移ではいけないのでしょうか?
         
     | 
| 
      
 6 
     | 
    
         
            +
            location.hrefでデータを送らない遷移ではいけないのでしょうか?
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # 追記
         
     | 
| 
      
 9 
     | 
    
         
            +
            とりあえずajaxの部分はこうしてください
         
     | 
| 
      
 10 
     | 
    
         
            +
            ```javascript
         
     | 
| 
      
 11 
     | 
    
         
            +
            <script>
         
     | 
| 
      
 12 
     | 
    
         
            +
            $(function(){
         
     | 
| 
      
 13 
     | 
    
         
            +
              $('form').on('submit',function(){
         
     | 
| 
      
 14 
     | 
    
         
            +
                var data = {};
         
     | 
| 
      
 15 
     | 
    
         
            +
                $(this).find('input[name]').each(function(){
         
     | 
| 
      
 16 
     | 
    
         
            +
                  data[$(this).prop('name')]=$(this).val();
         
     | 
| 
      
 17 
     | 
    
         
            +
                });
         
     | 
| 
      
 18 
     | 
    
         
            +
                console.log(JSON.stringify(data));
         
     | 
| 
      
 19 
     | 
    
         
            +
                $.ajax({
         
     | 
| 
      
 20 
     | 
    
         
            +
                type: $('form').attr('method'),
         
     | 
| 
      
 21 
     | 
    
         
            +
                url:  $('form').attr('action'),
         
     | 
| 
      
 22 
     | 
    
         
            +
                dataType: 'text',
         
     | 
| 
      
 23 
     | 
    
         
            +
                data: data,
         
     | 
| 
      
 24 
     | 
    
         
            +
                success:function(d){
         
     | 
| 
      
 25 
     | 
    
         
            +
                  console.log(d);
         
     | 
| 
      
 26 
     | 
    
         
            +
                },
         
     | 
| 
      
 27 
     | 
    
         
            +
                });
         
     | 
| 
      
 28 
     | 
    
         
            +
                return false;
         
     | 
| 
      
 29 
     | 
    
         
            +
              });
         
     | 
| 
      
 30 
     | 
    
         
            +
            });
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            </script>
         
     | 
| 
      
 33 
     | 
    
         
            +
            <form method="post" action="xxx.php">
         
     | 
| 
      
 34 
     | 
    
         
            +
            <input type="text" name="aaa" value="123">
         
     | 
| 
      
 35 
     | 
    
         
            +
            <input type="hidden" name="bbb" value="xyz">
         
     | 
| 
      
 36 
     | 
    
         
            +
            <input type="submit" value="go">
         
     | 
| 
      
 37 
     | 
    
         
            +
            </form>
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            ```
         
     |