im curious, if the value of <p class="myclass"></p>
assign by jquery using $('.myclass').text('txtvalue');
can be fetch using PHP script? example. like i want to fetch the assign value of jquery without using jquery post, ajax to pass value in PHP because im do this with only one page.
好奇,如果
的值由jquery使用$('。myclass')分配.text('txtvalue');可以使用PHP脚本获取?例。就像我想要获取jquery的赋值而不使用jquery post,ajax在PHP中传递值因为我只用一个页面来做这个。
here my code:
我的代码:
<p class='myclass'></p>
<?php
$a = strip_tags("<p>","<p class='myclass'></p>");
echo $a;
// the result is 100; but its dismase like im printing "<p class='myclass'></p>"; i im trying to do is to get exactly the value of "<p class='myclass'></p>". because the value of that, i will use to query in mysql id.
//it is impossible to me to do this?...
?>
<script>
$('.myclass').text('100');
</script>
1 个解决方案
#1
0
No, this cannot be done.
不,这不可能。
PHP runs server-side and generates your HTML, including any Javascripts with jquery in it. When it's done, Javascript gets to work, client-side. The only way to get something back into PHP is to send it to the server by posting it, ajax, or redirection.
PHP在服务器端运行并生成HTML,包括其中包含jquery的任何Javascripts。当它完成后,Javascript开始工作,客户端。将某些东西带回PHP的唯一方法是通过发布它,ajax或重定向将其发送到服务器。
#1
0
No, this cannot be done.
不,这不可能。
PHP runs server-side and generates your HTML, including any Javascripts with jquery in it. When it's done, Javascript gets to work, client-side. The only way to get something back into PHP is to send it to the server by posting it, ajax, or redirection.
PHP在服务器端运行并生成HTML,包括其中包含jquery的任何Javascripts。当它完成后,Javascript开始工作,客户端。将某些东西带回PHP的唯一方法是通过发布它,ajax或重定向将其发送到服务器。