如何将Jquery变量传递给选择查询的php变量? [英] How to pass a Jquery variable to php variables for the Select Query?
本文介绍了如何将Jquery变量传递给选择查询的php变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script 类型 =' text / javascript ' >
$(窗口).load(function(){
$(body) .click(function(){
var s = window.getSelection();
s.modify('extend','backward','word');
var b = s.toString();
s.modify('extend','forward','word');
var a = s.toString();
s.modify('move','forward','character');
var variablej = b + a; // variablej是Jquery变量
//怎么样将Jquery变量传递给php变量
<? php $ variablephp = < script> document.write(variablej)< / script> ? > // variablephp是php变量
<? php $ result = mysql_query( SELECT * FROM 翻译 其中 英语 =' $ variablephp' ); ? >
< / script >
解决方案
(窗口).load(function(){
(body)。click(function(){
var s = window.getSelection();
s.modify('extend','backward','word');
var b = s.toString();
s.modify('extend','forward','word');
var a = s.toString();
s.modify('move','forward','character');
var variablej = b + a; // variablej是Jquery变量
//如何将Jquery变量传递给php变量
<? php
variablephp = < script> document.write(variablej)< / script> ? > // variablephp是php变量
<? php
<script type='text/javascript'> $(window).load(function(){ $("body").click(function(){ var s = window.getSelection(); s.modify('extend','backward','word'); var b = s.toString(); s.modify('extend','forward','word'); var a = s.toString(); s.modify('move','forward','character'); var variablej=b+a; //variablej is Jquery Variable //how to pass a Jquery variable to php variable <?php $variablephp = "<script>document.write(variablej)</script>" ?> //variablephp is php variable <?php $result = mysql_query("SELECT * FROM translate where English='$variablephp'"); ?> </script>
解决方案(window).load(function(){
("body").click(function(){ var s = window.getSelection(); s.modify('extend','backward','word'); var b = s.toString(); s.modify('extend','forward','word'); var a = s.toString(); s.modify('move','forward','character'); var variablej=b+a; //variablej is Jquery Variable //how to pass a Jquery variable to php variable <?php
variablephp= "<script>document.write(variablej)</script>" ?> //variablephp is php variable <?php
这篇关于如何将Jquery变量传递给选择查询的php变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文