加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ofbiz ajax json

发布时间:2020-12-16 00:38:04 所属栏目:百科 来源:网络整理
导读:?? 1. 要想用 json 类型,可在 Controller .xml 用 type="jsonjava" type="none" 返回数据放于 request 中 $jq.ajax({ type:"POST", url:"@ofbizUrl"+u+"/@ofbizUrl?productId=" + id + "status="+status, dataType: "json", success: function(data) { $jq(
??

1.要想用 json 类型,可在 Controller .xml type="jsonjava" type="none" 返回数据放于 request

$jq.ajax({

type:"POST",

url:"<@ofbizUrl>"+u+"</@ofbizUrl>?productId=" + id + "&status="+status,

dataType: "json",

success: function(data) {

$jq('#p_'+id).html("("+data.status+")");

}

});

2.不用 json 类型, aj ax 可以调用另一个 ftl screen, 其效果相当于局部的 submit

3.$.post bug jquery 中自己的实现。

post: function( url,data,callback,type ) {

if ( jQuery.isFunction( data ) ) {

callback = data;

data = {};

}

return jQuery.ajax({

type: "POST",

url: url,

data: data,

success: callback,

dataType: type

});

}

可以看出,如果 data 不写的话 if 就不会执行, return 时, data 就会为空 .

所有在用 post ,时最好是加上空第二个参数,没有也要用 {}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读