0

I have a page which loads a login page, after the user logged in it will load some parts of another file into itself. The problem is that I want to know which button is pressed in the first page and have it in the login page. The first page loads login page using location.window and it refreshes the page. Is there a way to do this?

Anri
  • 6,175
  • 3
  • 37
  • 61
Homam
  • 707
  • 2
  • 9
  • 20
  • use ajax........`(..)` – Jai Mar 11 '13 at 10:52
  • I can not use ajax for this first page but all other pages is ajaxed and i have no problem with them. i saw some pages that we can attach data to window by ___events___ with jquery 1.4+ and tried that with nothing in results – Homam Mar 11 '13 at 10:53
  • 'which button' ? what are the buttons on the first page before the login page – mlwacosmos Mar 11 '13 at 10:54
  • the buttons are for select different functionality after login for example you choose file confirm and after login you go to file confirmation part – Homam Mar 11 '13 at 10:57

2 Answers2

2

Alternatively, You can take advantage of cookies/HTML5 localStorage to keep track of the page url.

vivek
  • 1,944
  • 1
  • 17
  • 26
  • and what about ie8 and lower? iknow i can use $.data or data-something but after page reload they all will be gone – Homam Mar 11 '13 at 10:59
  • 1
    Alternatively, you can use cookies too, for all browsers and their versions. – vivek Mar 11 '13 at 11:03
1

If you are using FORM then you can send the button information in hidden field, like

<input type="hidden" name="track" value="but1">

or if you are using GET method, you can send the info by query string, like

http://domain/login.php?track=but1
Sudip Pal
  • 2,041
  • 1
  • 13
  • 16
  • hi sorry i'm just writing UI code not server side and the scripts are not php too. i wonder if i can attach a simple line of data to page itself – Homam Mar 11 '13 at 10:56
  • It is an UI related code, there are no server side language added, form hidden field and query string is related to UI only... – Sudip Pal Mar 11 '13 at 10:58
  • sorry i have no forms and the buttons are just simple li and anchores – Homam Mar 11 '13 at 11:00