0

I have 2 pages say index.html and 2ndPage.html. index.html has two textboxes and a button. Now i want to enter some data in the textboxes and received the data in 2ndpage.html. I want to use only javascript. dont want to use query string. Only post or get method. Is it possible? Please help me or guide me how to send and receive data form one page to another in javascript/jquery.

Saikat
  • 410
  • 2
  • 9
  • 25
  • can't i do this without php? please help me. i want to use only javascript. is it possible? – Saikat Feb 06 '13 at 10:30
  • you can get it by post method in php. why do you want do it by JS? – polin Feb 06 '13 at 10:30
  • is it mandatory to use php if i use get or post method. I want some code. any appropriate link will be highly appreciated. – Saikat Feb 06 '13 at 10:32
  • You need to know the difference between the usase of server-side and client side programming. And the ways how data can be passed. Without any control you cannot really pass data. so read about it – polin Feb 06 '13 at 10:36
  • You can use cookies, but why are you limiting yourself in the first place? What are you trying to accomplish? – Zirak Feb 06 '13 at 10:47

2 Answers2

2

Well, using javascript or jquery you can accomplish that. Check jQuery's AJAX function. Otherwise, learn PHP as already mentioned in the comments.

Savas Vedova
  • 5,622
  • 2
  • 28
  • 44
  • even AJAX would require a server side language like PHP or ASP – Nishant Jani Feb 06 '13 at 10:35
  • well not really. If you use GET then you have the query string (though the question tells us that qs is not preferred), which means you can parse it with JS and get the required strings. Although I'd recommend using a server side language, this is quite possible with javascript. – Savas Vedova Feb 06 '13 at 10:42
1

using localStorage or sessionStorage you can do this. here is a link, which will help you. i just take few css property from one page to another page. but you can take input value also. Taking css property from one html page to another page

or if you are taking care of old browser also then javascript Location object is the way to go.

Community
  • 1
  • 1
naresh kumar
  • 2,165
  • 3
  • 19
  • 21
  • thank you very much naresh. will you please provide the code without the session storage? actually session storage is a HTML5 property. But i just want to use the basic. Is it possible? – Saikat Feb 06 '13 at 10:44
  • ok. if you are not familiar with these, then you can do this using old method like save a cookie and next page retrieve it. try this. same link only you will get cookie reference also. – naresh kumar Feb 06 '13 at 10:52