How to return variable ajax php

0

I'm developing a form via ajax / php, when I click on the desired item the form sends the data to the ajax and displays it in the div, however I need to return a value but I can not.

JS:

//script do form
$("#copPasta").focus(function(){
var val = new Array();
$('.check:checked').each(function(){
    val.push($(this).val());
});
$.ajax({
    url:'copPasta.php',
    type:'GET',
    data:'valor=' + val,
    success:function(data){
        $('.exibeCopPasta').html(data);
    }
});
return false;
});

PHP:

        <?php //ajax
    if( isset( $_GET['valor'] ) ){
        $a = explode(',' , $_GET['valor']);
        foreach( $a as $value ){
            $a_value = explode('/' , base64_decode($value));
            $f_value = array_pop($a_value);
            echo $f_value."<br />";
            //gera array descriptografado
            $array[] = base64_decode($value);
        }
    }
    $c = 1;
    return $c;
    ?>

o $ c in php I would need to confirm the reading and enable the function, there then in the main form if set variable $ c executes the copy function. What am I doing wrong?

    
asked by anonymous 20.01.2016 / 18:34

0 answers