Hi i need a way to pass PHP value to processing.js how can i do this. I know that i got to use AJAX but i don't know what to do to recive value in processing.js. I've tryed something like that
<script type="text/javascript">
function go(){
        var s;
    var variable = 5;
    $.ajax({
        method:"POST",
        tupe:"POST",
        url: "take.php",
        data:({val:variable}),
        success: function(data){
            //$('#msg').html(data);  
                            var b = data;
                            s=b;
        }
    });
            alert (s);
    }
</script>
and my PHP is:
<?php
if($_POST){
    $img = "index.jpg"  ;
    echo $img;
}
?>
but when i alert 's' it is undefined and i dont know how to pass it to processing code to show image in to a canvas. Can someone felp me?
 
     
     
    