使用POST方法从一个HTML传递价值的另一个HTML价值、方法、POST、HTML

2023-09-10 20:46:42 作者:孤街浪徒

我想通过从一个HTML两个值(参数)到另一个HTML而不网址显示的值(即同样喜欢交法)。 如何获得使用JavaScript或AJAX或jQuery的第二个HTML的价值。

i want to pass two values(parameters) from one html to another html without displaying the values in url(i.e same like post method). How to get the value in 2nd html using javascript or ajax or jquery .

例如:

client.html

client.html

<html>
<body>

<form id="Form1" action="http://xyz/plus/server.html" method="post">
<table width="40%">
    <tr><td>Country:</td><td><input type="text" name="country" id="country" />  </td></tr>
    <tr><td>Language:</td><td><input type="text" name="lang" id="lang" /></td></tr>
    <tr><td align="center"><input type="submit" /></td></tr>
</table>
</form>

</body>
</html>

server.html

server.html

<script>?? </script> 

如何开始使用JavaScript或AJAX或jQuery的在server.html文件数据。 plz帮助我.... 在此先感谢

how to get data in server.html file using javascript or ajax or jquery . plz help me.... Thanks in advance

推荐答案

如果您不希望从URL传递值,您可以propabally使用JavaScript cookies来传递的价值观。或youy将被要求使用AJ​​AX POST方法来requried值传递给下一个HTML 这里是$ C $下的ajax post方法调用

if you would not like to pass values from URL, you can propabally use the javascript cookies to pass the values. or youy will be required to use ajax post method to pass requried values to next html here is the code for ajax post method call

$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});