1 - Setup a webserver 2 - Create a page that allows users to submit their name a
ID: 3881473 • Letter: 1
Question
1 - Setup a webserver
2 - Create a page that allows users to submit their name and a ticket number to a SQL Express database on the webserver. (Automatically track the date data submitted)
3 - Create a page that that displays the contents of the SQL database sorted by date and Name and then a count of the ticket numbers.
What i need to know is the syntax for the webpages and the syntax for the queries needed to access data. for the purpose of this test. let the user column be Worker_NAME and ticket ID be from the TICKET_ID column. I am rusty on SQL. database information will be provided to me later. I need the webpage data that I can fill in with the provided database info, username, and password
Explanation / Answer
Dear student:
follow the below steps to complete your requirement.
HTML code:
//Plain javascript code.
var data = {
username:"user name",
password:"password"
};
var request = new XMLHttpRequest();//create HTTP request
request.onload = function () {
var status = request.status; // response status, e.g., 200 for "200 OK"
var data = request.responseText; // Returned data, from ticket details
}
request.open("POST", "Server URL here", true);
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
request.send(postData);//post the request to server
//Using JQery
<script type="text/javascript">
function getticketDatails() {
var loginData = {
username: $("username").val(),
password:$("#password").val()
} //create a object to send over http post body
//create AJAX request to post data to server and get reponse from server
$.ajax({
url: 'URL of server',
type: 'post', //protocal method type POST or GET
dataType: 'json', // result data type
success: function (data) { //handling result
$('#target').html(data);
},
data: loginData //passing login data to request
});
}
</script>
Database query:
select Worker_NAME,count(TICKET_ID) from worker_details group by Worker_NAME order by Worker_NAME,worker_date;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.