IDE 缺少基础能力集调用库,这是一个简单的Ajax调用。
var jsonObj;
var xmlhttp = null;
function callAsync(url, callbackSuccess)
{
xmlhttp = new Ajax();
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange=function()
{
// readyState = 4 ; "complete"
if (xmlhttp.readyState==4)
{
// status = 200 ; "ok"
if(xmlhttp.status == 200)
{
uiManager.showNotification(1000, "ok", "Done");
/*
* Remove the substr "jsonFlickrApi(" from the responseText
*/
var text = xmlhttp.responseText;
text = text.substr(14, text.length-15);
// Create JSON Oject
jsonObj = eval('(' + text + ')');
callbackSuccess(jsonObj);
}
else
{
uiManager.showNotification(1000, "warning", "Failed to get data from server");
}
}
}
xmlhttp.send(null);
}
相关文档:
前段时间写JSP,使用AJAX以POST方式提交数据,如果是中文字符提交就会乱码,后来写ASP时用到AJAX以POST方式提交数据,中文一样是乱码。搜索一下相关资料,问题应该是提交数据时是以UTF-8编码提交,所以接收时如果使用GB2312或者其它中文编码的话就会乱码。
使用GET方式提交数据的时候,中文问题很好解决,setRequestHeader ......
AJAX表单提交方法(JSON)
1./*****JAVA**************************************************************/
JAVA类中:
/*****JAVA**************************************************************/
2./*****struts.xml**************************************************************/
struts.xml文件中:
......
<mce:script type="text/javascript"><!--
function login(){
var postURL = "http://localhost:8080/cas/simpleLogin";
var params = {
"loginUrl":$("#loginUrl").val(),
"service":$("#service").val(),
"login":$( ......
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv=
"Content-Type"
conten ......
PopupControl扩展器控件可以附加到任何控件之上,当用户点击该控件时,将弹出一个预先指定好的、显示附加信息或用来帮助用户执行某些设定的Panel。当该控件失去输入焦点之后,Panel将自动消失,且用户在其中进行的配置将被设定到扩展器的目标控件之上。
实 ......