Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]jquery laravel autocomplete
Puchatek320
post
Post #1





Grupa: Zarejestrowani
Postów: 68
Pomógł: 0
Dołączył: 4.11.2019

Ostrzeżenie: (0%)
-----


Cześć,
Mam problem z ustawieniem ścieżki dostępu w jquery


  1.  
  2. Route::get('gettag', 'ajaxtagController@getajaxtag');
  3. Route::post('gettag', [
  4. 'uses' => 'ajaxtagController@getajaxtag',
  5. 'as' => 'ajaxtagController.getajaxtag'
  6. ]);
  7.  
  8.  
  9. Controler
  10.  
  11. class ajaxtagController extends Controller
  12. {
  13. public function getajaxtag(){
  14.  
  15. echo "sprawdz czy działa";
  16. }
  17. }
  18.  
  19.  
  20. i autocomplete
  21.  
  22.  
  23. $(function() {
  24. $( "#tag" ).autocomplete({
  25. source: "{{ route('ajaxtagController.gettag') }}"
  26. });
  27. });
  28.  
  29. var id = 0;
  30. $("#addTag").click(function(){
  31. if($("#tag").val() ) {
  32.  
  33. id++;
  34. var li = document.createElement("li");
  35. li.className = "tags";
  36. li.setAttribute("id", id);
  37.  
  38. var i = document.createElement("INPUT");
  39. i.setAttribute("name","multiTag[]");
  40. i.setAttribute("type","hidden");
  41. i.setAttribute("id", id);
  42.  
  43. var tag = document.getElementById('tag').value;
  44.  
  45. li.innerHTML = " " + tag + ' <button class=\"deleteTag btn-delete\" id=\"'+id+'\">X</button>'
  46. i.setAttribute("value", tag);
  47.  
  48. $("#tagList").append(li)
  49. $("#tagList").append(i)
  50. $('#tag').val('');
  51. }});
  52.  
  53. $("#tagList").on('click', 'button.deleteTag', function() {
  54.  
  55. var idDiv = this.id;
  56. $("#"+idDiv).remove()
  57. $(":input[id='"+idDiv+"']").remove();
  58.  
  59. });
  60.  
  61. $("#tagList").on('click', 'button.deleteTagExsit', function() {
  62.  
  63. var del_id = this.id;
  64. var toDel = del_id.replace('id_', '');
  65. $("#id_"+toDel).remove();
  66. $.ajax({
  67. type:'POST',
  68. url:'modules/script/query/delete-tag.php',
  69. data:'delete_id='+toDel
  70. });
  71.  
  72. });
  73.  

i wyrzuca mi scieżkę dostępu:
http://localhost/videosite/public/%7B%7B%2...20%7D%7D?term=s
co robię źle?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 06:35