I was trying to call PHP script through AJAX call from the react js script or when a submit button is clicked in the react component. I did this using normal HTML and JQuery but find it difficult to implement the same using react.
One of the user explained the normal flow of input and display it as alert. But i want that input values to be sent to the PHP script. The JQuery code for that is :
$('#button').click(function () {
alert("first")
$.ajax({
type: "GET",
crossDomain: true,
url: "http://localhost:8085/Folder1/login.php",
data: {
stime: $("#demo1").val(),
etime: $("#demo2").val(),
desc: $("#servername").val()
},
success: function(data){
alert(data)
$('#resultip').html(data);
},
error:function(data)
{
alert("Data sending failed");
}
});
I am new to react and unable to get any document which explains this to do in react. Any help is highly appreciated.