php captcha使用jquery ajax

i have included a captcha functionality to my wordpress site using this plugin: https://github.com/claviska/simple-php-captcha

however i am having difficulities validating the form data and captcha using ajax.

i using .submit() to make an ajax post request which sends all the form data to a php file.

however the problem i am facing is that the captcha code keeps changing and therefore my validation will always result to invalid.

this code is placed at the top of single.php:

session_start();
require_once('library/includes/plugins/simple_php_captcha/index.php');
$_SESSION['captcha'] = simple_php_captcha();

this code is placed further down single.php:

<img src="<?php echo $_SESSION['captcha']['image_src'];?>" alt="captcha"/>

this code is placed in ajax-submit.php

session_start();
if($_POST){
    echo "<pre>";
    echo print_r($_POST);
    echo "</pre>";
    echo $_SESSION['captcha']['code'];
}

this is the .submit()

$("form").submit(function () {

   var input_captcha = $("#input_captcha").val();

        $.ajax({
            url: 'ajax-submit.php',
            type: "POST",
            data: "input_captcha="+input_captcha,
            //dataType: "json",
            cache: false,
            success: function(data) {

            }
        });

        return false;

    });

where am i doing/going wrong??