I need a help to send current page url to my database or to email without page redirection ..!Thank you!
Asked
Active
Viewed 9,868 times
2 Answers
7
You can send it through an AJAX request, taking the URL from window.location
or document.URL
.
With jQuery, this would be as simple as
$.ajax({
type: 'POST',
url: 'http://example.com/report.php',
data: 'url=' + window.location.toString()
});

István Ujj-Mészáros
- 3,228
- 1
- 27
- 46

foxy
- 7,599
- 2
- 30
- 34
2
See this for getting the current URL: Get current URL in web browser
Once you have the URL you should be able to just send it via AJAX.
-
1freedompeace's post gives this to you. I wasn't sure if you were using jQuery, ExtJS or plain JavaScript nor did I know what your PHP page would accept (POST? GET? What format? etc) so I didn't add any code as I didn't know if it would add value or not to my answer. – Kris Aug 07 '11 at 03:43