我的文字是获得JSON数据:
<script type="text/javascript" src="jquery-1.7.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$( #useruname ).change(function() {
var userName = $(this).val();
$.ajax({
type: GET ,
url: ajaxuseradd.php ,
data: {
uname: userName
},
success: function(data, status, xhr) {
$("#fname").val(data.fname);
$("#lname").val(data.fname);
$("#email").val(data.email);
});
},
dataType: json
})
});
});
</script>
<form action="adduser.psp" method="get">
<fieldset>
<label for="uname">Username:</label>
<select name="uname" id="useruname">
<%
Random Python Code
%>
<%= options %>
</select>
</fieldset>
<fieldset>
<label for="fname">First Name:</label>
<input type="text" name="fname" />
</fieldset>
<fieldset>
<label for="lname">Last Name:</label>
<input type="text" name="lname" />
</fieldset>
<fieldset>
<label for="email">Email:</label>
<input type="text" name="email">
</fieldset>
我发现的错误如下:
updateAdduser is not defined
onchange()onchange (line 2)
event = change
[Break On This Error] updateAdduser();