we can access Php variable using JavaScript. but we can't directly access JavaScript variable value using Php because php, python, java that are Server Side Languages. and JavaScript, jQuery is a Client Side Languages...
for Pass Value of Javascript Variable to Server Side languages you need to Call AJAX Request
$.ajax({
url: example.com/test.php, //pass here Url...
type: 'GET', //method type ... GET, POST
dataType: 'html', //(html or JSON) not necessary but if you want to need pass then you can..
headers: {
// if you need pass authentication tokens then you can do it using headers in AJAX request
},
data: {
id: id; // pass here your data which you want to pass
},
success: function (data) {
here you will be get success Response
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…