Jquery 提前打印邮件请求
我一直在尝试使用post,而不是默认的get,同时又不破坏typeahead的良好特性。除了我似乎想不出来,我努力想弄明白这一点,但现在我一点线索也没有 谁能给我指出正确的方向吗?我对新代码进行注释的代码是:Jquery 提前打印邮件请求,jquery,ajax,typeahead.js,typeahead,twitter-typeahead,Jquery,Ajax,Typeahead.js,Typeahead,Twitter Typeahead,我一直在尝试使用post,而不是默认的get,同时又不破坏typeahead的良好特性。除了我似乎想不出来,我努力想弄明白这一点,但现在我一点线索也没有 谁能给我指出正确的方向吗?我对新代码进行注释的代码是: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Submit Deal test</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- for twitter typeahead bundle -->
<script src="js/typeahead.bundle.js"></script>
</head>
<?php /*authenticate the user is going from submitdeal.php*/
session_start();
$_SESSION['token'] = 10;
?>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
var brands;
brands = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: 'brands.php?query=%QUERY'
/*url: 'brands.php'
// since we use POST, the URL never changes so we simulate a different URL for each query
// for the typeahead internal request cache.
replace: function (url, uriEncodedQuery){
return url + "#" + uriEncodedQuery; // the part after the hash is not sent to the server
},
beforeSend: function (jqXhr, settings){
jqXhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
settings.type = 'POST';
settings.hasContent = true;
settings.data = $.param({beneficiary: queryInput.val()});
},*/
}
});
brands.initialize();
$('.typeahead').typeahead(null, {
displayKey: 'name',
source: brands.ttAdapter()
});
});//]]>
</script>
</head>
<body>
<input class="typeahead" type="text" placeholder="begin typing the brand" autocomplete="off">
</body>
</html>
提交交易测试
//
请参见