P
P
pavuuuk2019-09-04 10:00:35
JavaScript
pavuuuk, 2019-09-04 10:00:35

How can I send the text of the link to the server when I click on it?

How can I send the title of the article to the server? It is impossible to enter the name in the parameters for each link in the href, because a lot of articles
5d6f610dc8309902543830.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hzzzzl, 2019-09-04
@hzzzzl

How do you fill in the site manually?
"You can't enter the name in the parameters for each link in the href, because there are a lot of articles" - it is necessary just so that the server generates these href as it needs

S
Sergey Pavlov, 2019-09-04
@isergirud

Well, in general, we hang a regular listener on links. Below I threw an example when with a comment.
// This way we can get the text of all links
// If necessary, then limit the choice of the necessary links, for example, by class
// Further, you can already work with the hrefText variable. Send an ajax request to the server.
https://pastein.ru/t/zX
But there I indicated a cycle for all links. Accordingly, in your case, hang onClick in a similar way to pull out the link text.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question