您好我正在尝试使用ajax json的jquery模板,我从服务器获取数据,但是当我将该对象传递给模板时,它显示无法读取属性' push'未定义的错误[错误的图片截图] [1]
我已经对此进行了一些研究,但未能得到结果。请你们大家一起帮助我。
脚本模板
<ul class="entrylist" id="show_application_list">
<script type="text/x-jquery-tmpl" id="show_application_list_template" >
<li class="even">
<div class="entry_wrap">
<div class="entry_content2">
<h4><a id='${jobid}' class='view_job_details'>${position}</a></h4>
<big><strong>Applied On:</strong> ${applied_date}</big>
<big><strong>Status:</strong>
{{if scheduled_date}}
<button id="" class="stdbtn btn_lime show_application_details">Shortlisted</button>
{{else}}
<p><big><strong>Under Review</strong></big></p>
{{/if}}
</div>
<br>
<div class="entry_content2 show_application_details_content" style="display:none">
<form class="stdform stdform2" method="post" action="#">
<p>
<label>Interview On</label>
<span class="field">
{{if scheduled_date}}
${scheduled_date}
{{else}}
<p><big><strong>Under Review</strong></big></p>
{{/if}}
</span>
</p>
{{if interview_response}}
<p>
<label>Interview Response</label>
<span class="field">${interview_response}</span>
</p>
<p>
<label>Interview Status</label>
<span class="field">${interview_status}</span>
</p>
<p>
<label>Interview Experience<small>Grade your experience out of 5 <small></label>
<span class="field"><input type="number" min="0" max="5" name="lastname" id="lastname2" class="longinput"></span>
</p>
<p>
<label>Comment</label>
<span class="field"><textarea name="lastname" id="lastname2" class="longinput"></textarea></span>
</p>
<p class="stdformbutton">
<button id="${interview_id}" type="button" class="stdbtn btn_lime update_interview_experience">Update Feedback</button>
</p>
{{/if}}
</form>
</div>
</div>
</li>
</script>
</ul>
Javascipt Code
function show_application_employees(){
$("#applicationlabel").hide();
$.ajax({
type:"post",
url:'functions/functions.php?activity=getapplicationemployees',
success:function(data)
{
var obj = $.parseJSON(data);
console.log(obj)
if(obj.length == 0){
$("#applicationlabel").show();
}else{
$("#applicationlabel").hide();
$("#show_application_list").find(".even").remove();
$("#show_application_list_template").tmpl(obj).appendTo("#show_application_list");
$(".view_job_details").on("click",show_job_details);
$(".show_application_details").on("click",show_application_details);
}
}
});
}
更多scrren镜头我的代码在这一点失败: error in jquery