HEX
Server: Apache
System: Linux 4485441ca2e2 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 11:03:07 UTC 2025 aarch64
User: (1000)
PHP: 8.2.24
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/ganryu_shop/js/requestAjax.js
function ganryu_shop_requestAjax(url, method, func, data){
	var x = new XMLHttpRequest();

	var p = "";
	var dataSend = "";
	var contenttype = null;
	if (data){
		if (method=="POST" && data.datatype == "formdata"){
			dataSend = data.data;
		}
		else{
			for(var nm in data){
				if (p != "") p += "&";
				p += encodeURIComponent(nm)+"="+encodeURIComponent(data[nm]);
			}
			if (method == "POST"){
				contenttype = 'application/x-www-form-urlencoded' ;
			}
		}
	}
	if (p != ""){
		if (method=="POST"){
			dataSend = p;
		}
		else{
			url += "?"+p;
		}
	}

	x.open(method, url, true);
	if (contenttype){
		x.setRequestHeader('Content-Type', contenttype);
	}

	x.onerror = function(xobj){
		alert('network error');
	}
	x.error = function(xobj){
		alert('network error');
	}
	x.onreadystatechange = function(xobj){
		if (x.readyState == 4){
			var resTxt = x.responseText;
			if (!resTxt){
				resTxt = x.response;
			}
			var res;
			eval("res="+resTxt);
			if (!res){
				func({success:false, message:null});
				return;
			}
			if (""+res.success != "1"){
				var errmsg = res.message;
				func({success:false, message:errmsg});
				return;
			}
			func({success:true, data:res});
		}
	}
	
	x.send(dataSend);
}