First Commit
This commit is contained in:
		
						commit
						7a497b1d4e
					
				
							
								
								
									
										22
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>Widuri Client</title>
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <table>
 | 
			
		||||
      <tr>
 | 
			
		||||
        <th>ID<th>
 | 
			
		||||
        <th>Name<th>
 | 
			
		||||
        <th>Phone<th>
 | 
			
		||||
      </tr>
 | 
			
		||||
 | 
			
		||||
      <tr>
 | 
			
		||||
        <td></td>
 | 
			
		||||
        <td></td>
 | 
			
		||||
        <td></td>
 | 
			
		||||
      </tr>
 | 
			
		||||
      
 | 
			
		||||
    </table>
 | 
			
		||||
    <script src="js/carrack.js"></script>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										19
									
								
								js/carrack.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								js/carrack.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
function sendHttpRequest(url, method, data, callback, contentType = "multipart/form-data", authorization = "") {
 | 
			
		||||
  var xhr = new XMLHttpRequest();
 | 
			
		||||
  xhr.open(method, url, true);
 | 
			
		||||
  xhr.setRequestHeader("Content-Type", contentType);
 | 
			
		||||
  xhr.setRequestHeader("Authorization", authorization);
 | 
			
		||||
  xhr.onreadystatechange = function () {
 | 
			
		||||
    if (xhr.readyState === 4) {
 | 
			
		||||
      if (xhr.status === 200) {
 | 
			
		||||
        var response = xhr.responseText;
 | 
			
		||||
        callback(null, response);
 | 
			
		||||
      }
 | 
			
		||||
      else callback(xhr.status, null);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  var requestData;
 | 
			
		||||
  if (contentType === "application/json") requestData = JSON.stringify(data);
 | 
			
		||||
  else requestData = data;
 | 
			
		||||
  xhr.send(requestData);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user