JosiahMaybe
Bronze Coder
Good hi, I am trying to just set a variable to a database and like my starting point is Javascript client side where I am trying to find if this works.
I am trying to find something that works as far back as possible and on all (or maybe most) browsers.
I am trying not to use jQuery as that is like for only most up to date browsers.
I do not need Internet Explorer support, that is too old now.
Just trying to find how to call a PHP script from Javascript and have it just save stuff and not go away from current page.
This seems like it should work according to research and Microsoft Edge browser testing (it 404 d but it sent a request seemingly).
I think I understand how PHP would need to handle like this but does it work?
I am using placeholders.
With placeholders, likeMyPHP.php is a placeholder and so is MyData.
I know someone may need PHP and a database maybe to test this.
I would use responseText for whether to allow something so I need like that.
Absent PHP needed for this, does this run correctly if a PHP script is present?
I would be setting a country code and a timestamp if that helps.
I would also be using MySQL databases.
I realize I may need to use GET not SET.
X E.
JavaScript:
var xhttp = new XMLHttpRequest();
xhttp.onload = function() {
// use this.responseText;
}
xhttp.open("SET", "likeMyPHP.php?q=MyData");
xhttp.send();
I am trying to find something that works as far back as possible and on all (or maybe most) browsers.
I am trying not to use jQuery as that is like for only most up to date browsers.
I do not need Internet Explorer support, that is too old now.
Just trying to find how to call a PHP script from Javascript and have it just save stuff and not go away from current page.
This seems like it should work according to research and Microsoft Edge browser testing (it 404 d but it sent a request seemingly).
I think I understand how PHP would need to handle like this but does it work?
I am using placeholders.
With placeholders, likeMyPHP.php is a placeholder and so is MyData.
I know someone may need PHP and a database maybe to test this.
I would use responseText for whether to allow something so I need like that.
Absent PHP needed for this, does this run correctly if a PHP script is present?
I would be setting a country code and a timestamp if that helps.
I would also be using MySQL databases.
I realize I may need to use GET not SET.
X E.
Last edited: