日期:2014-05-16  浏览次数:20328 次

sturct2 jqueryJson例子

sturct2 配置

前提是? sturct2 配置好json拦截器

?

<action name="xxx" class="xxxAction">
??? ??? ??? <result type="json">
??? ??? ??? ??? <param name="includeProperties">
??? ??? ??? ??? ??? objects\[\d+\]\.id,objects\[\d+\]\.name
??? ??? ??? ??? </param>
??? ??? ??? </result>
??? ??? </action>

?

$.ajax({
??? ??? type:'post',
??? ??? dataType:'json',
??? ??? url:'',
??? ??? success:function(result){
??? ??? ??? $.each(result.objects,function(index,object){

????????????????????????????? alert(object.id);

????????????????????????????? alert(object.id);
??? ??? ??? ??? );
??? ??? ??? });
??? ??? },
??? ??? error:function()
??? ??? {


??? ??? }
??? });