将值从Javascript传递给PHP
问题描述:
可能重复:
如何将JS变量传递给php?
如何将值从Javascript代码传递给PHP变量。
How can I pass value from Javascript code to PHP variables.
假设我们有这个:
aa = $("#amount").text($("#progressbar").progressbar("option", "value")+"%");
在< script>
标签中声明在Javascript中,我希望在PHP代码中获取或调用它。
declared in the <script>
tag of the Javascript, I want this to be fetch or called in the PHP code.
答
$.ajax({ url: 'test.php',
data: {action: 'aa'},
type: 'POST',
success: function(output) {
alert(output);
}
});