Prototype学习笔记,试用Ajax.Request,发现个问题,先记下来。
传了个参数进去,发现传中文会出现乱码!
<script src="js/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function ExecuteAjax()
{
var id=$F('empid');
var url ='http://localhost/MyASPNETAJAX/AjaxDemo.aspx';
var prams = 'id='+id;
var myAjax = new Ajax.Request(url,{method:'get',parameters:prams,onLoading:loading,onComplete:ShowResult});
}
function ShowResult(Result)
{
$('resultdiv').value = Result.responseText;
$('showloading').style.display="none";
}
function loading()
{
$('showloading').innerHTML="加载中,请稍后.";
}
</script>
<select id="empid" onchange="ExecuteAjax()">
<option value ="第一项11">第一项</option>
<option value ="222222">第二项</option>
<option value ="333333">第三项</option>
</select>
<textarea id="resultdiv" cols="60" rows="10"></textarea>
<div id="showloading"></div>
<script type="text/javascript">
function ExecuteAjax()
{
var id=$F('empid');
var url ='http://localhost/MyASPNETAJAX/AjaxDemo.aspx';
var prams = 'id='+id;
var myAjax = new Ajax.Request(url,{method:'get',parameters:prams,onLoading:loading,onComplete:ShowResult});
}
function ShowResult(Result)
{
$('resultdiv').value = Result.responseText;
$('showloading').style.display="none";
}
function loading()
{
$('showloading').innerHTML="加载中,请稍后.";
}
</script>
<select id="empid" onchange="ExecuteAjax()">
<option value ="第一项11">第一项</option>
<option value ="222222">第二项</option>
<option value ="333333">第三项</option>
</select>
<textarea id="resultdiv" cols="60" rows="10"></textarea>
<div id="showloading"></div>