I am trying to pass a PHP variable to JQUERY. I tried the following script but the var 'id' is not been passed to upload_avatar.php. Guess i am making some mistake. Can anyone help me.
$(document).ready(function (e) {
    $("#uploadForm").on('submit',(function(e) {
        e.preventDefault();
        var id = '<?php echo $id; ?>';
        $.ajax({
            url: "upload_avatar.php",
            type: "POST",
            data:  new FormData(this)
            contentType: false,
            cache: false,
            processData:false,
            success: function(data)
            {
            $("#targetLayer").html(data);
            },
            error: function() 
            {
            }           
       });
    }));
});
 
     
     
    