Open syahrul223 opened 4 years ago
Im using Emojionearea here, then i want to use autocomplete from API data with POST method here is my code :
function get_account(){ var form = new FormData(); form.append('page', 'all'); $.ajax({ url : "{{$mentionRoute}}", type: "POST", contentType:false, processData: false, data : form, headers: { 'X-CSRF-Token': '{{csrf_token()}}' }, beforeSend: function(){ }, success: function(res){ console.log(res); $("#post-content").emojioneArea({ autocomplete: true, events:{ ready: function() { this.editor.textcomplete([{ id: 'post-content', match: /\B@([\-\d\w]*)$/, search: function(term, callback) { callback($.map(res, function(mention) { return mention.indexOf(term) === 0 ? mention : null; })); }, template: function(value) { return '<b>' + value + '</b> '; }, replace: function(value) { return '<b>@' + value + '</b> '; }, cache: true, index: 1 }]); }, keydown: function(b,e){ var tval=this.getText(); set_content_text(tval); }, keyup: function(b,e){ var tval=this.getText(); set_content_text(tval); }, emojibtn_click:function(b,e){ var tval=this.getText(); set_content_text(tval); }, paste:function(b,e){ var tval=this.getText(); set_content_text(tval); } } }); }, error: function(xhr, status){ console.log(xhr); console.log(status); } }); }
but the data didn't show up on the textarea, but the response data is there. what is my mistake ...? anyone can help?
Im using Emojionearea here, then i want to use autocomplete from API data with POST method here is my code :
but the data didn't show up on the textarea, but the response data is there. what is my mistake ...? anyone can help?