var yaoqingsai = function(options) { var listEl = $(this.listHtml); listEl.bind('click',function(){ if (!SJ_UT.id){ location.href = "http://usercenter.500px.me/login?service="+location.href; return ; } listEl.find('.invite-mask').show(); }) listEl.find('.btn-primary').bind('click',function test(){ $.ajax({ // 提交数据的类型 POST GET type : "post", // 提交的网址 url : "/community/contest/invite/findByCode", // 提交的数据 data : { inviteCode : listEl.find('.invite-input-code').val() }, dataType : "json",// "xml", "html", "script", "json", success : function(data) { if (listEl.find('.invite-input-code').val().length == 0){ sjApp.showMsg({cls : "error",html: "请输入邀请码"}) } if(data.status == 501 && listEl.find('.invite-input-code').val().length != 0){ sjApp.showMsg({cls : "error",html: "未找到指定大赛"}) }else if (data.status == 200){ var contestId = data.contestId; var url = '/community/contest/details/invite/' + contestId; location.replace(url); }else if (data.status == 504){ var linkStr = ""; if(data.detailsShow != 0){ linkStr = "点击这里围观。"; } sjApp.showMsg({cls : "error",html: "参赛人数已满!"+linkStr}) } }, error : function(e) { sjApp.errorMsg(e); } }); }); options.parent.find('.photo_grid .row').append(listEl); }; yaoqingsai.prototype = { listHtml : ' ' }