1

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 .

example :

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

<script>?? </script> 

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

Tarun
  • 13
  • 1
  • 4

3 Answers3

1

Your question is not very much clear. but what i understood from your question is that you want something like below using jQuery

Write this in page1.html

$.ajax({
    url:"page2.html?parm1=v1&p2=v2",
    type:"POST"
    success:function(){
    },
    error:function(){
    },
 });

To read the parameter in page2.html follow this

Community
  • 1
  • 1
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
0

If you aren't using any scripting language than all you can do is use a container . Load new html's in a container say - iframe and save the data globally.

Janak
  • 4,986
  • 4
  • 27
  • 45
0

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
});
Ganesh Bora
  • 1,133
  • 9
  • 17