- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
hi,
this the first time i’m create a server side so i’m kinda lost in here.. :)
i want to from my client side to send the data to the server and the server validate the data and send back the response.
so i found something like this when i was searching
function submitData() {
console.log(‘Sending Data’);
var JSONObject = {};
var url = ‘http://mywebsite/server/’
// construct an HTTP reques
var xhr = new XMLHttpRequest();
xhr.open(‘POST’, url, true);
xhr.setRequestHeader(‘Content-Type’, ‘application/json; charset=UTF-8’)
// send the collected data as JSON
xhr.send(JSON.stringify(JSONObject));
xhr.onloadend = function () {
//check the result & error messages
};
}
i’m need help :(
thanks in advance.
… what is your question?
I have no idea how to submit form with native js.
in jQuery you can use $.post or $.get
example:
$.post(‘process.php’, {field1: “value”, field2: “value”}, function(result){ //result is response from process.php, such as echo $value etc. });
hope it helps.
Hello friend
this is also one of the code for js to php
session_start();
// … php code …
echo ‘‘;
?>