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

ajax request json format

发布时间:2020-12-16 01:33:14 所属栏目:百科 来源:网络整理
导读:function addIssue_ajax(pageindex){//添加评论//请求的地址 var login_is = "%=session.getAttribute("cur_user")%";if(login_is == "null"){alert("对不起,评论之前,请先登录!");window.location="itemAction/itemAction!retrieveItem_name";return fal
function addIssue_ajax(pageindex){//添加评论
			//请求的地址   
			var login_is = "<%=session.getAttribute("cur_user")%>";
			if(login_is == "null"){
				alert("对不起,评论之前,请先登录!");
				window.location="itemAction/itemAction!retrieveItem_name";
				return false;
			}
			var url = "replyAjax/replyAjaxAction!create_reply";
			var reply_con = $("textarea").val();
			if(reply_list == null){
				reply_con = null;
			}
			var replier = "<%=cur_user%>";
			var postid =  "<s:property value='#request.post_single.postid'/>";
			if(pageindex == -1){
				pageindex = 1;
			}else if(pageindex == 0){
				pageindex = $("span[id='cur_page']").text();
			}
			if(reply_con == ""){
				alert("评论内容不能为空");
				return false;
			}
		 
			$.post(url,{
				'reply_con': reply_con,'replier': replier,'postid': postid,'pageindex':pageindex
			},function(data){
				member = eval('('+data+')');
				alert("回复成功!");
				$("textarea").val("");	
				reply_list = member;
				addReply_js(parseInt(reply_list[reply_list.length-2]));
				$("span[id='replynum']").text(reply_list[reply_list.length-1]);
				$("span[id='cur_page']").text(reply_list[reply_list.length-2]);
				check_list(reply_list[reply_list.length-1],reply_list[reply_list.length-2]);
			},'json');
		}
		
		function invert_replyPage_ajax(pageindex){//分页的ajax请求
			//请求的地址   
			var url = "replyAjax/replyAjaxAction!creat_viewallreply";
			var postid =  "<s:property value='#request.post_single.postid'/>";
		 
			$.post(url,{
				'postid': postid,function(data){
				member = eval('('+data+')');
				reply_list = member;
				addReply_js(parseInt(reply_list[reply_list.length-2]));
				$("span[id='replynum']").text(reply_list[reply_list.length-1]);
				$("span[id='cur_page']").text(reply_list[reply_list.length-2]);
				check_list(reply_list[reply_list.length-1],'json');
		}

(编辑:李大同)

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

    推荐文章
      热点阅读