0

I want to pass a number from page's url and be able to use it multiple times inside ajax loaded content (modal) on top of this page.

Url looks like this:

mysite.com/node/1

Is it possible to access url of the original(referring) page even after more ajax calls? For getting the number from referring url I tried to use $_SERVER["REQUEST_URI"] but it works only for first ajax call. Another ajax call made from previous ajax loaded content gets url of ajax content.

Is there any way to store variable and use it multiple times and then delete it when it is not needed?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
user1031743
  • 319
  • 1
  • 5
  • 14

1 Answers1

0

You could get the URL parameter again from the URL with JavaScript, even after first ajax call. Example here: How to get the value from the GET parameters?

Community
  • 1
  • 1
BenB
  • 2,747
  • 3
  • 29
  • 54
  • Hi, does the javascript solution work also for url of the page, that was ajax call made from? I need to use the variable inside ajax loaded content, first , second etc., until I close the modal window. Thank you. – user1031743 Nov 22 '15 at 03:46
  • If its in the same browser window (meaning the modal is just HTML that was added to the DOM of the page), yes. – BenB Nov 22 '15 at 03:49