简体   繁体   English

jQuery如何获取完整的GET操作值

[英]JQuery how to get the complete GET action values

I have a url http://localhost/mysite/conts?values=test&value2=tes2 我有一个网址http://localhost/mysite/conts?values=test&value2=tes2

when the page is load this will be the output. 当页面加载时,这将是输出。

<p>The Get Value is "values=test&value2=tes2" </p>

I want to put all the complete GET value in my hidden input. 我想将所有完整的GET值放入隐藏的输入中。 Is it possible? 可能吗?

If you're using PHP, your conts page would look like this: 如果您使用的是PHP,则conts页面将如下所示:

<?php    
$values = $_GET["values"];
$value2 = $_GET["value2"];
?>

<p>The Get Value is "values=<?php echo $values; ?>&value2=<?php echo $value2; ?>" </p>

Given your url: http://localhost/mysite/conts?values=test&value2=tes2 , your output would be: 给定您的网址: http://localhost/mysite/conts?values=test&value2=tes2 ,您的输出将是:

<p>The Get Value is "values=test&value2=tes2" </p>

HTML 的HTML

<input type="hidden" name="url" id="url"/>

jQuery jQuery的

var url = "http://localhost/mysite/conts?values=test&value2=tes2";
$("#url").val(url.split("?")[1]);

Check value in your hidden field it is set to values=test&value2=tes2 . 检查您隐藏字段中的值,将其设置为values=test&value2=tes2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM