json returning data

json returning data

hey guys im having a problem returning the data in the json array...when alerting data.value it comes back at 1000+ which is truely incorrect....can anyone explain where i am going wrong please?...thank you
 
  1. <!

    DOCTYPE html>

    <

    html>

    <

    head>

    <script type="text/javascript" src="/ajax/jquery/libary/jquery.js"></script>

    </

    head>

    <

    body>

    <?php

    $game_type

    = array();

    $division

    = array();

    if

    ($_POST['game'] == 1)

    {

    $game_type[] = array('value' => '1',

    'text' => 'TDM'

    );

    $game_type[] = array('value' => '1',

    'text' => 'CTF'

    );

    $division[] = array('value' => '1',

    'text' => 'Divison 1'

    );

    }

    elseif

    ($_POST['game'] == 2)

    {

    $game_type[] = array('value' => '1',

    'text' => 'CTF'

    );

    $division[] = array('value' => '1',

    'text' => 'Divison 2'

    );

    }

    json_encode(

    $game_type);

    json_encode(

    $division);

    ?>

    <

    form>

    <

    script>

    $(document).ready(

    function(){

    $(

    "select#game").change(function(){

    var post_string = "game=" + $(this).val();

    $.ajax({

    type:

    'POST',

    data: post_string,

    cache:

    false,

    dataType:

    'game_type',

    url:

    'json.php',

    timeout:

    '2000',

    error:

    function() {

    alert(

    "Error has occured");

    },

    success:

    function(data) {

    alert(data.length);

    alert(data[1].text);

    }

    });

    });

    });

    </

    script>

    <

    select name="game" id="game">

    <option value=""></option>

    <option value="1">Counter Strike</option>

    <option value="2">COD</option>

    </

    select>

    <

    select name="sub_category" id="sub_category">

    <option value="">-- Select First Value --</option>

    </

    select>

    </

    form>

    </

    body>

    </

    html>