How to assign the value of a javascript variable to a php variable

前端 未结 3 465
广开言路
广开言路 2021-01-26 07:53

I\'ve a form.

3条回答
  •  猫巷女王i
    2021-01-26 08:48

    The easiest way would be to use a hidden input field and use jQuery to set the value for this input field or these input fields in your case.

    HTML:

    
        
        
        
        
    
    

    JS:

    $('#nameSave').click(
        function() {
            var pos = $('#name').position();
            $('#posLeft').val(pos.left);
            $('#posRight').val(pos.right);
        }
    );
    

提交回复
热议问题