Js, PHP WITH AJAX: how to determine the letter grade of students using javascript with ajax?

Have you tested it?

yes it’s still the same

Your code is still wrong. Try making a request to here, http://stonecipherprojects.com/api/

Use Postman or whatever. If the request makes it to the server, it will tell you how

My test code:

<!doctype html>
    <div id='score'>5</div>

    function GetXmlHttpObject()
 try {
   var xmlHttp = null;
   if (window.XMLHttpRequest)
     // If IE7, Mozilla, Safari, etc: Use native object
     xmlHttp = new XMLHttpRequest()
     if (window.ActiveXObject)
       // ...otherwise, use the ActiveX control for IE5.x and IE6
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 

   return xmlHttp;
 } catch(e)

var xhttp = GetXmlHttpObject();
var scoreElement = document.getElementById('score');
xhttp.open("post", "process.php", true);

xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
score = "score=5";
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
scoreElement.innerHTML = "Your Score: " + this.responseText;
console.log('Grade calculation complete');

Sponsor our Newsletter | Privacy Policy | Terms of Service