【发布时间】:2014-07-27 06:31:55
【问题描述】:
jQuery 代码:
$(document).ready(function() {
$('#s-results').load('get_report1.php').show();
$('#search-btn').click(function(){ showValues(); });
$(function() {
$('form').bind('submit', function() { showValues(); return false; });
});
function showValues() {
$.post('get_report1.php', { name: form.name.value },
function(result) {
$('#s-results').html(result).show();
}
);
}
});
HTML:
<form name = "form">
<div>Enter name</div>
<input type="text" name="name" id="fn" />
<input type="submit" value="Search" id="search-btn" />
<div>
<input type="text" id="se2" name="search22">
</div>
</form>
<div id = "s-results" style="height:50px;">
</div>
到目前为止,脚本运行良好。现在我只想再次过滤上述函数返回的 HTML。
为了实现这一点,我尝试了这行代码:
$(result).filter('#se2');
在带有result参数的函数下,但是不起作用。
那么如何过滤返回的HTML代码呢?
【问题讨论】:
标签: javascript jquery html scope jquery-traversing