-1
我得到所有文本框字段中的所有ajax值..我怎樣才能在paricular field ..中獲得特定值..plz幫助我如何獲取位置字段中的位置,machin_no字段中的machin_no字段等..我發送下面的代碼爲這個問題...如何獲得特定文本框中的差異值
function getuserName(strURL)
{
var req = getXMLHTTP();
if (req)
{
//function to be called when state is changed
req.onreadystatechange = function()
{
//when state is completed i.e 4
if (req.readyState == 4)
{
// only if http status is "OK"
if (req.status == 200)
{
document.getElementById('location').value=req.responseText;
document.getElementById('msrno').value=req.responseText;
document.getElementById('cust_no').value=req.responseText;
//var name = document.getElementById('location').value=req.responseText;
}
else
{
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
</head>
<body>
<div id="content" class="regtitle">
<div id="regform">
<form name="formreg">
<div id="rowone">
<label>Customer Name</label> <input name="custname" id="custname" type="text" placeholder="Customer Name" onkeydown="getuserName('getdata.php?custname='+this.value)"/>
<label>Current Locaiton</label> <input name="location" id="location" type="text" placeholder="Current Location" />
</div>
<div id="rowtwo">
<span><label>Machine Sr. No.</label> <input name="msrno" id="msrno" type="text" placeholder="Machine Sr. No."/></span>
<span id="custno"><label>Customer No.</label><input name="custno" id="cust_no" type="text" placeholder="Customer No." />
</span>`enter code here`
您必須顯示示例響應。 –
響應的格式是什麼?純文本? HTML? JSON?整數? – RamRaider