如何将一个Javascript变量发送到php变量? [重复]

This question already has an answer here:

 <script>
    function myHandler(){
    var idproduct = myHandler.caller.arguments[0].target.id;    
    document.getElementById("product").value = idproduct;
    }
 </script>


<input class="form-control" id="product" name="view"  type="text" disabled " />
        <?php $product_view = X ?>

Some one know what can I add on my javascript so I can send the variable "idproduct" to product_view variable

</div>

Use a form and Post or Get You can also optionally use WebSockets or you can probably use a request to a .php page setup to handle such of another type of request.

I suggest to create a hidden field and then treat that in your post back or call back