Ajax Fancy Capture in CakPHP

Posted by Constantin.FF on Stack Overflow See other posts from Stack Overflow or by Constantin.FF
Published on 2012-08-28T15:36:49Z Indexed on 2012/08/28 15:38 UTC
Read the original article Hit count: 288

Filed under:
|
|
|
|

I have found a nice ajax capture which i would like to use in a CakePHP framework website. The plugin can be found here: http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin

What I have tried:

in the controller:

public function index($slug = null, $capture = false) {
    if($capture AND $capture =="get_capture"){
    $rand = rand(0,4);
    $_SESSION['captcha'] = $rand;
    echo $rand;

    die;
    }

    if (!empty($this->data) && $_POST['captcha'] == $_SESSION['captcha']) {
            .... save the post
    }
}

in the view:

$selectURL = "      $(function() {
            $('.ajax-fc-container').captcha({
                borderColor: 'silver',
                captchaDir: 'http://localhost/img/capture',  
                 url: 'http://localhost/contacts/index/contacts/get_capture',
                 formId: 'MessageIndexForm',
            });
        });";
$this->Html->scriptBlock($selectURL, array('inline' => false));

also I have tried with url: 'http://localhost/js/capture.php' which is the original file coming with the plugin but still not working.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery