更新时间:2023-11-21 11:18:10
修改您的脚本标签,如下所示:
modify your script tag like this:
<script type="text/javascript">
function gotoa(){
$.get("http://localhost:8080/2_8_2012/jsp/GetJson.jsp", function(result) {
var storedata={
identifier:"ID",
label:"name",
items: result
};
var store = new dojo.data.ItemFileWriteStore({data: storedata});
});
}
</script>
GetJson.jsp的代码是:
The code for GetJson.jsp is :
<%@page contentType="application/json" %>
<%@page import="MyPackage.PopulateTextbox" %>
<%
String temp1;
PopulateTextbox obj = new PopulateTextbox();
temp1 = obj.method();
%>
<%=temp1 %>
现在调用 gotoa()
它将初始化ajax调用并在回调函数
Now call gotoa()
it will initialize the ajax call and get the response in callback function