无法获取基于使用AJAX发送到php的唯一表单的唯一数据

I am trying to setup a page that displays observations, and if one of the observations is clicked then it will send the observation number of the observation clicked to php. Then when they are redirected to a details screen it will populate the details of the observation clicked. I have tried many different ways to get this done, so my code is kind of all over the place, but It seems that no matter how I do it either the Ajax doesn't send the data or it sends the same observation number every time. To me it seems like the AJAX data attribute can't deal with i. This is being built in Intel XDK, which is a html5 app builder. That is why this is tricky because I can't use browser developer tools to debug.

Javascript

 <script>
  $(document).ready(function(){    
   $.ajax({
     url: "http://localhost/observationMain.php",
     data: { action: "observationID" },
     type: 'post',
     dataType: 'json',
     success: function(observationID){
         for(i = 0; i <= observationID.length; i++)

         {

            $("#observationMainListView").append("<form id='form"+i+"'' method='post'><a id='observation"+i+"' class='list-group-item allow-badge widget uib_w_"+(i+4)+"' data-uib='twitter%20bootstrap/list_item' data-ver='1'><h4 id='observationNum"+i+"' class='list-group-item-heading'>"+observationID[i][0]+"</h4><p class='list-group-item-text'>"+observationID[i][1]+"</p></a><input name='observationNum' value='"+observationID[i][0]+"'></form>");


             $("#observation"+i+"").click(function(){
                    $.ajax({
                    url: "http://localhost/observationDetail.php",
                    data: $("#form"+i+"").serialize(),
                    type: 'post',
                    success: function(observationNum){
                             document.location.href = 'observationDetail.html';   
                    }
                    });

                });

        }
    }
    });

    });


</script>

php

<?php
session_start();

if(isset($_POST['observationNum'])){
$_SESSION['observationNum'] = $_POST['observationNum'];
}
?>

This might be crazy but check this line.The form's id property has an extra ' may be that's causing the issue.

$("#observationMainListView").append("<form id='form" + i + "'' method='post'

I cant run the script but just give it shot.