我正在制作一个类似的小型系统。我已经成功地向我的数据库发送了一个ajax帖子,其中我用1增加了tblarticles。row.like现在在我发送ajax帖子的同一页面上,我想在每次ajax帖子之后更新该字段的值。现在我的问题是我需要刷新,然后才能看到 1 而不是标准的 0
阿贾克斯邮政
$.ajax({
url:"articles" ,
type: "post",
data: {
'user_id':userid[0].value,
'article_id':articleid[0].value,
'user_id_fk':useridarticle[0].value,
'_token': token[0].value
},
success: function(data){
console.log(data);
}
});
Run Code Online (Sandbox Code Playgroud)
看法article/index.blade.php
@foreach($articles as $article)
<div class="work-container">
<article class="work-item">
<a href="{{action('HomeController@showArticle', [$article->id, $article->title])}}" class="work-thumbnail">
<img src="/articlePics/{{$article->image}}" alt="work-item">
</a>
<div class="work-info">
<span class="user">{{$article->title}}</span>
<div class="actions">
<form id="actionForm" action="" method="post" role="form">
<input type="hidden" name="articleId" value="{{$article->id}}">
<input type="hidden" name="userIdFk" value="{{$article->user_id}}">
<input type="hidden" name="userID" value="{{Auth::id()}}">
<input type="submit" name="like" class="likeBtn" id="test" value="Like">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
</form> …Run Code Online (Sandbox Code Playgroud) 我现在想知道如何删除/清除另一个数组中的整个数组。
这就是我的数据的样子。我想知道如何清除数组“companyvote”。有什么建议?
{
"_id" : ObjectId("55529cbb056565e80d963fac"),
"email" : "test@test.be",
"img" : "\img\1920x12001431477435530.jpg",
"companyvote" : [
"Lovely inc",
"Behond imagination"
],
"__v" : 0
}
Run Code Online (Sandbox Code Playgroud) 是否可以分别为每种吐司类型设置 toastr 选项?
我的烤面包机代码
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-bottom-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "60000",
"extendedTimeOut": "60000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
const infoMessage = $(".js-toast-message-info").html();
if (infoMessage && infoMessage.length > 0) {
toastr.info(infoMessage);
}
const errorMessage = $(".js-toast-message-error").html();
if (errorMessage && errorMessage.length > 0) {
toastr.error(errorMessage);
}
const warningMessage = $(".js-toast-message-warning").html();
if (warningMessage && warningMessage.length > 0) {
toastr.warning(warningMessage);
}
const successMessage = …Run Code Online (Sandbox Code Playgroud)