ajax request json format

前端之家收集整理的这篇文章主要介绍了ajax request json format前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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');
		}
原文链接:https://www.f2er.com/ajax/162060.html

猜你在找的Ajax相关文章