Ajax ile her değeri gönderebilirsiniz sonrası düğmesinin bir grup kurmak istiyorum. Js kısmını değiştirmek nasıl?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
function saveUserInfo()
{
var msg = document.getElementById("msg");
var f = document.user_info;
var userName = f.user_name.value;
var url = "value.php";
var postStr = "user_name="+ userName;
var ajax = false;
if(window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
if (ajax.overrideMimeType) {
ajax.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject) {
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!ajax) {
window.alert("wrong");
return false;
}
ajax.open("POST", url, true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send(postStr);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
msg.innerHTML = ajax.responseText;
}
}
}
</script>
</head>
<body >
<div id="msg"></div>
<form name="user_info" id="user_info" method="post">
<input name="user_name" type="hidden" value="abc" /><br />
<input type="button" value="abc" onClick="saveUserInfo()">
<input name="user_name1" type="hidden" value="def" /><br />
<input type="button" value="def" onClick="saveUserInfo()">
<input name="user_name2" type="hidden" value="ghi" /><br />
<input type="button" value="ghi" onClick="saveUserInfo()">
</form>
</body>