<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<script src="sample.js"></script>
<script src="jquery.js"></script>
<title>mouse</title>
</head>
<body onload="sample()">
<p id="memo"></p>
</body>
</html>
function sample(){
str = "p2.php?x=" + "neko";
$("#memo").load(str);
}
<?php
$memo=$_GET["x"];
$fp = fopen("data.txt", "w");
fwrite($fp,$memo);
fclose($fp);
print("write");
?>