i want to display data, after clicked on button

here my html code

<button id="b">do it</button>  @foreach($  student as $  q)     {{$  q}}} @endforeach 

here my ajax code

$  (document).ready(function () {     $  ("#b").bind("click",function ()     {         var id = "888";         $  .ajax({            url:"/insert_",            method:"post",            data:{                id:id           }         });     }); }); 

here my code in controller

public function data(Request $  request) {     $  student = $  request->input('id');      return view("welcome",[         "qwe"=>$  student     ]); } 

here my code in route


it is shown to meвведите сюда описание изображения

please help

Advertisement module with number of visitor clicked on it [on hold]

In drupal 8, is there any advertisement module which generating report of number of visitor clicked on it. On every page refresh it should show any random advertisement from the list i added.

I have been looking for such type of module from last 2 days and didn’t find it. So, finally i thought to ask it here.

Any type of help will be highly appreciated.

Thanks in advance.

Execute some “code” when an external link is clicked

I’m very new to Drupal 8 and would really appreciate any advice about the best way to tackle my problem. I am creating an online video catalog that indexes videos from external vendors. All the videos are played on the vendor website after the user clicks the “play” button from my video catalog. I need some things to happen when the play button is clicked.. 1) I want to increment a counter that is a field on the node to keep track of how many times the video has been played globally. 2) I want to flag the video as watched for only that user so they can access a watched history. 3) Depending on the vendor I need to build the actual link to play the video to include the user’s id for authentication at the vendor’s website so they are redirected to the video.

I am struggling with how to accomplish all of this in Drupal 8. Do I need to write a custom module? Is there a contrib module or a combo of contrib modules that I can use?

Any advice on the best way to begin this would be very much appreciated.

Thank you!

I created a file type and an interpreter for the file type. I want to enable the interpreter run the file type once the file type is doublr clicked

I created a file type called oox, I created an interpreter for the file type. I used to do all of the task python.

I compiled the source code with pyinstaller to get the exe of the interpreter, the exe works perfectly; now i want to make the program to run the file type without asking user for input, but rather; through double clicking on the oox file.

What do i need to add to the source code to perform the task?.

The first set of lines after the import statements for the interpreter are below:

print(‘Please input the .oox file:’) doc = input() #This is the oox file

Toggling the class of a div to show/hide content based on which button is clicked

I am trying to show/hide a list of menu items based on which button is clicked for that particular category. Most Popular is seen by default/on page load. So for example when I click on the Appetizers button the page should go from this:

go from this

to this

I am still very new to jQuery and JavaScript so I am having some difficulties getting this to work. Here is the HTML (condensed, just wanted to show what was seen in the screenshots and not all of the other menu items):

            <div class="menu-container">              <div class="menu-preview">                 <div class="menu-preview-items active">                      <h2>Most Popular</h2>                      <div class="menu-listing">                         <h3>California Roll (8 Pieces)</h3>                         <p>Imi crab, cucumber, avocado, and mayo with                             sesame</p>                         <p>$  3.50</p>                     </div>                      <div class="menu-listing">                         <h3>Dynamite Roll (8 Pieces)</h3>                         <p>Two pieces prawn tempura, yam, cucumber,                             avocado, masago, letters, and mayo with sesame</p>                         <p>$  4.95</p>                     </div>                  </div>                  <div class="menu-preview-items hidden">                      <h2>Appetizers</h2>                      <div class="menu-listing">                         <h3>Edamame</h3>                         <p>Boiled green soy bean with salt.</p>                         <p>$  3.50</p>                     </div>                      <div class="menu-listing">                         <h3>Gomae</h3>                         <p>Blanched spinach with sesame seed and peanut sauce.</p>                         <p>$  3.50</p>                     </div>                  </div>             </div>              <div class="menu-categories">                 <a href="#" class="menu-box">Most Popular</a>                  <a href="#" class="menu-box">Appetizers</a>                  <a href="#" class="menu-box">A La Carte</a>                  <a href="#" class="menu-box">BBQ</a>                  <a href="#" class="menu-box">Salad & Soup</a>                  <a href="#" class="menu-box">Tempura</a>              </div>          </div> 

Here is the CSS for the classes of .active and .hidden (as well as the container):

.active { display: none; }  .hidden { display: contents; }  .menu-container { margin-top: 15px; display: flex; justify-content: space-evenly; } 

Here is the script that I have so far as well (which is placed at the very bottom of the document, just above the closing body tag):

    <script>     $  ('.menu-box').click(function () {         $  ('.menu-preview-items').toggleClass('.active');         // alert('Hello!');     });     </script> 

I will of course be adding more menu items for all the categories over time, I just wanted to try and get this to work before I commit to doing so. Should I be adding id’s to anything? Do I need to add/edit any of my class names? Any help would be greatly appreciated!

Change Tab position in Viewpager when clicked in listview

I have passed string from fragment to fragment (from list view to swipe views). But My problem is when I click on a item in the listview, it replaced fragment and goes to the viewpager from the first, not the same item of the tab.

Here String is passing, but viewpager tab is not changing.

Listview fragment where I clicked on item:

listView.setOnItemClickListener(new OnItemClickListener() {      @Override      public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {          ////          String text=listView.getItemAtPosition(i).toString();          Bundle bundle = new Bundle();          bundle.putString(ID_EXTRA, text);          // set Fragmentclass Arguments          SwipeNav fragobj = new SwipeNav();          fragobj.setArguments(bundle);           FragmentManager fm=getFragmentManager();          FragmentTransaction ft = fm.beginTransaction();          ft.replace(((ViewGroup)(getView().getParent())).getId(), fragobj);          ft.addToBackStack(null);          ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);          ft.commit();      }  }); 

On the viewpager Swipe view page:

@Override public void onViewCreated(View view, Bundle savedInstanceState) {     super.onViewCreated(view, savedInstanceState);     if (getArguments() != null && !getArguments().isEmpty()) {         Bundle bundle = this.getArguments();         String myInt = bundle.getString(ListNavAdapter.ID_EXTRA);          myPagerAdapter  = new  MyPagerAdapter(getChildFragmentManager(),getContext());         viewPager = (ViewPager) view.findViewById(R.id.pager);      } else {         myPagerAdapter = new  MyPagerAdapter(getChildFragmentManager(),getContext());         viewPager = (ViewPager) view.findViewById(R.id.pager);     }      viewPager.setAdapter(myPagerAdapter); 

I am unable how I will set the code so that I will be able to get the proper position of the tab in the viewpager when I will click on a item in the listview. I am using Single fragment for multiple tabs for Viewpger Swipe views.

Is it possible to automatically strip out ad portion of urls when clicked on

Here is one example.


I see this a lot. I’d like to strip away everything before https://www.safeway.com automatically. Maybe you know of a browser extension that does this.

How can I choose the name point I’ve clicked in?

I need to improve this python code. This code is saving mouse clicking coordinates. I would like to set a name in each point I click and set sign where I’ve clicked. Is that possible?

import cv2, numpy as np  # Path to source video: output_path = '/home/stephen/Desktop/clicks.csv'  # Mouse callback function global click_list positions, click_list = [], [] def callback(event, x, y, flags, param): if event == 1: click_list.append((x,y)) cv2.namedWindow('img') cv2.setMouseCallback('img', callback)   img = cv2.imread('/home/stephen/Desktop/test214.png')   # Mainloop - show the image and collect the data  while True:  cv2.imshow('img', img)      # Wait, and allow the user to quit with the 'esc' key  k = cv2.waitKey(1)  # If user presses 'esc' break   if k == 27: break          cv2.destroyAllWindows()   # Write data to a spreadsheet  import csv  with open(output_path, 'w') as csvfile:  fieldnames = ['x_position', 'y_position']  writer = csv.DictWriter(csvfile, fieldnames = fieldnames)  writer.writeheader()  for position in click_list: x, y = position[0], position[1] writer.writerow({'x_position': x, 'y_position': y})