Wikipedia api native javascript

Hello . I can not get normal json data. The information what I receive is not complete.

My code

document.getElementById('search').addEventListener('click',function(val){
    let userInput = document.getElementById('userInput');
    let term = userInput.value;
    let wikiRequest = new XMLHttpRequest();
    
   
    let url = 'https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=god&origin=*&format=json';
    
    wikiRequest.open('GET', url)
    wikiRequest.onload = function() {
        let data = JSON.parse(wikiRequest.responseText);
     
        let array = data.query.search;
        for(var i= 0; i < array.length; i++){
            let output = document.getElementById('output');
            output.insertAdjacentHTML('beforeEnd', '<h3>'+array[i].title+'</h3>' + '<p>'+ array[i].snippet +'</p>' );
            // console.log(array[i]);
        }
        console.log(data);
    }
    wikiRequest.send();
} )

i think problem is in parameters of wiki api what i pointed out. I will be very grateful for any help.

Hi, I want to receive full information about term what i searching for .

The task is completed. Sorry my mistake. How can I close this topic?

USE THIS PLEASE:

function Wiki(lang){
	this.lang = lang || "fr";
	this.inuse = false;
}
Wiki.prototype.research = function(s, callback){
	if(this.inuse){
		console.error("Wiki est déjà en cours d'utilisation !");
	} else {
		this.inuse = true;
		let r = new XMLHttpRequest();
		r.onload = function(){
			Wiki.prototype.inuse = false;
			let j = JSON.parse(r.responseText);
			callback(j);
		}
		r.open('GET', "https://" + this.lang +".wikipedia.org/w/api.php?%20action=opensearch&format=json&origin=*&profile=normal&search="+encodeURIComponent(s));
		r.send();
	}
}

//EXEMPLE
var c = new Wiki();
c.research("Victor Hugo", function(result){
	console.log(result);
});