Ajax請求搜索詞點擊統計實現的代碼片段,以下代碼為項目開發中的片段,實現方法思路僅供參考。
//搜索詞點擊統計
$('.hot-word').on('click', function () {
var id = $(this).attr('data-id');
var words = $(this).attr('data-words');
$.ajax({
type: "post",
url: Config.searchWordsUrl,
data: {
id: id,
words: words,
'_csrf-frontend': $('meta[name="csrf-token"]').attr('content')
},
dataType: "json",
success: function (message) {
console.log(message);
}
});
});
//搜索詞點擊統計
$('.hot-word').on('click', function () {
var id = $(this).attr('data-id');
var words = $(this).attr('data-words');
$.ajax({
type: "post",
url: Config.searchWordsUrl,
data: {
id: id,
words: words,
'_csrf-frontend': $('meta[name="csrf-token"]').attr('content')
},
dataType: "json",
success: function (message) {
console.log(message);
}
});
});