$.ajax

基本的な書き方

function hoge(x,y){
		$.ajax({
		url: './sample.php',
		type: "GET",
		//変数を渡す(必要なければ省略)
		data: {
			id: x,
			password: y
		},
		dataType: "json",	
		success: function(data){
		//成功したときの処理
		console.log("こんにちは、" + data.name + "さん");
		},
		error:	function(){
		//失敗したときの処理
		console.log("エラー");
		}
	});
}