如何使该脚本通过$('#result').html(search); 搜索到 php 文件,以便我以后可以使用它来建立 MySQL 连接?
我已经将它连接到 php 文件:$('#result').load('class.search.php');
$('form').submit(function() {
var form_data = ($(this).serialize());
window.location.hash = form_data.replace('=','/');
return false;
});
(function() {
window.App = {
Models: {},
Collections: {},
Views: {},
Router: {}
};
App.Router = Backbone.Router.extend({
routes: {
'': 'index',
'search/:search': 'search',
'*other': 'default'
},
index: function() {
$(document.body).append("");
},
search: function(search) {
$('#result').load('class.search.php');
}
});
new App.Router();
Backbone.history.start();
})();
--
<form name="input" action="" method="get">
Search: <input type="text" name="search">
<input type="submit" value="Submit">
<div id="result"></div>
</form>