0
下一個代碼工作好..Struts2的jQuery插件+如何從JavaScript做電阿賈克斯標籤選擇
<s:url id="remoteurl" action="jsonsample"/>
<sj:select
href="%{remoteurl}"
id="language"
onChangeTopics="reloadsecondlist"
name="language"
list="languageObjList"
listKey="myKey"
listValue="myValue"
emptyOption="true"
headerKey="-1"
headerValue="Please Select a Language"
/>
但:有<s:url id="remoteurl" action="jsonsample"/>
這些代碼加載,一旦加載網頁...我要執行的操作從JavaScript這樣的:
<div id="result" style="width: 100px; height: 100px; background-color: green;">Click me!</div>
<script type="text/javascript">
$(document).ready(function() {
$("#result").click(function() {
Here ... How execute the action "jsonsample"? and refresh in the select "language"
});
});
</script>
什麼是#result,一個按鈕?你想達到什麼目的?爲什麼? –
結果只是一個div的id,這一行是up的。該div具有事件點擊,該事件點擊應該執行名爲「jsonsample」的動作,該動作返回對象JSON。問題是ajax如何調用,然後如何在sj:select中更新此JSON返回值。 – Ivan