Ajax請求搜索詞點擊統(tǒng)計實現(xiàn)的代碼片段,以下代碼為項目開發(fā)中的片段,實現(xiàn)方法思路僅供參考。
//搜索詞點擊統(tǒng)計
$('.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);
}
});
});
//搜索詞點擊統(tǒng)計
$('.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);
}
});
});