Please Help! How can i change this code to ionic code?

Please Help! How can i change this code to ionic code?
0

#1
var postContainer=document.getElementsByClassName("post-con");
var postImg=document.getElementsByClassName("post-img");
var imgs=document.getElementsByTagName('img');
var postContainer1=document.getElementById("post-con1");

    var ourRequest = new XMLHttpRequest();
    ourRequest.open('GET','https://www.polomaxten.com/wp-json/wc/v1/products?fields=18&consumer_key=ck_12f20405...a&consumer_secret=cs_8185...705304b444&per_page=100');
    ourRequest.onload= function() {
		if(ourRequest.status >= 200 && ourRequest.status < 400){
			var data = JSON.parse(ourRequest.responseText);
			createHTML(data);
			}else{
				console.log("We connected to the server but return error.");
				}
		};
		
		ourRequest.onerror=function(){
			console.log("Connection error");
			};
			
			ourRequest.send();

function createHTML(postData){
	
	var i=null;
	var ourHTMLString1="";
	var ourHTMLString2="";
	var number=0;
	var postCategories="";
	//postContainer.innerHTML=postData.length;
	alert("test");
	
	var aa=[];
	var bb=[];
	var cc=[];
	var dd=[];
	var ee=[];
	var ff=[];
	var gg=[];
		
    var polomax="";
    var j=0;k=0;l=0;m=0;n=0;o=0;p=0;q=0;
    var ourHTMLString3="";
    var poloid=postData[0].categories[0].id;
    var polomax=[{a:aa},{b:bb},{c:cc},{d:dd},{e:ee},{f:ff},{g:gg}];
  
    for(i=0;i<postData.length;i++){
		postCategories=postData[i].images;
		
		if(i===14){continue;}
		//alert(postData[i].categories[0].id);
		switch(postData[i].categories[0].id){
          case 45:  
                    aa[j]=postData[i];
                    j++;
                    //postContainer[i].innerHTML=polomax[0].a[0].name;
				break;			
		   case 25:
					bb[k]=postData[i];
					k++;	
		    	break;
		    case 16:
					cc[l]=postData[i];
					l++	
		    	break;
		    case 17:
					dd[m]=postData[i];
					m++;
		    	break;
		    case 20:
					ee[n]=postData[i];
					n++;	
		    	break;
		    case 19:
					bb[o]=postData[i];
					o++;
		    	break;
		    case 18:
					ff[p]=postData[i];
					p++;	
		    	break;
		    case 22:
					gg[q]=postData[i];
					q++;
		    	break;						
			}
			number++;

     postImg[i].src=polomax[0].a[0].images[0].src;
     
     postContainer1.innerHTML=polomax;
		}
		
	
	
}

#2

I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#3

thank you so much, sir