-
Notifications
You must be signed in to change notification settings - Fork 51
JsonResult
Johannes Geppert edited this page Jun 27, 2015
·
1 revision
This sample works with an JSON result that returns an array of customers. The json action is the same like in the grid example.
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
<head>
<sj:head/>
<script type="text/javascript">
$(document).ready( function() {
$.subscribe('handleJsonResult', function(event,data) {
$('#result').html("<ul id='languagesList'></ul>");
var list = $('#languagesList');
$.each(event.originalEvent.data, function(index, value) {
list.append('<li>'+value+'</li>\n');
});
});
});
</script>
</head>
<body>
<div id="result">Click on the link bellow.</div>
<s:url var="jsonurl" action="jsonlanguages"/>
<sj:a id="ajaxjsonlink"
href="%{jsonurl}"
dataType="json"
onSuccessTopics="handleJsonResult"
button="true"
buttonIcon="ui-icon-gear"
>
</body>
</html>
- Home
- Ajax
- UI widgets
- UI interactions
- Resizable for Divs
- Drag and Drop for Divs
- Selectable for Divs
- Sortable for Divs
- Form Elements
- Tasks