0

I am sending data to log.php

Due to window.location page is redirecting when sending data.

can i send data to log.php without redirecting current page?

setTimeout(function(){ 

var a = "http://example.com/log.php?c=";

window.location = a+trim;


});
3
  • What is trim? This will throw an error trim is not defined. Commented Dec 26, 2019 at 10:21
  • Its a variable which i defined previously on code. basically it contains a domain name. Commented Dec 26, 2019 at 10:23
  • If you don't want to use ajax then you can put an "image" i the html e.g <img src="http://example.com/log.php?c=123" /> this would also work when javascript is disabled (though in 2020ish that's not really a concern) Commented Dec 26, 2019 at 10:30

1 Answer 1

0

By XMLHttpRequest

xhttp.open("GET", "url", true);
xhttp.send();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.