我有这个代码,我想使用ajax从default.aspx发布文本到search.aspx,这可能吗?
的Default.aspx
PNode List::getNewNode(const int value) {
PNode node = new Node(value);
return node;
}
AJAX.js
<div id="container">
<div id="search-container">
<input id="search" type="search" placeholder="look for Musics"/>
<ul></ul>
</div>
</div>
search.aspx
$(document).ready(function() {
$('#search').bind('keyup', function() {
var searchTerm = jQuery.trim($(this).val());
if(searchTerm == '') {
$('#search-container ul').html('');
}
else {
//send the data to the database
$.ajax({
url: 'search.aspx',
type: 'GET',
data: { search:searchTerm },
beforeSend: function() {
$('#search-container ul').html('<li>Loading...</li>');
},
success: function(data) {
$('#search-container ul').html(data);
}
});
}
});
});
所以这是我的代码 我无法从default.aspx页面获取文本到search.aspx
答案 0 :(得分:1)
尝试string term = Request["search"]