L
L
LenS20202020-04-22 18:18:25
JavaScript
LenS2020, 2020-04-22 18:18:25

How to substitute the value from the url into an already running script?

QIBTS.png

I am making an online coloring site.

var url is the address of the picture that can be colored. this works great. let's say the address of my service is: krasim.ru/online I will add a button to colorize online, for example, to the pictures on the site. krasim.ru/online?= https://krasim.ru/sobaka.jpg that is, after the question mark there will be the address of the picture question: how to insert the entire value after the "?" i.e. how to cut the link i found. but I don't know how to paste the result there. I will explain using the example var url = window.location.href if I insert it into var url, then when the page loads in the code, I will see var url = window.location.href, and not the result. this is the main snag. How can I insert the result into var url? Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-22
@Palehin

What prevents getting the address after clicking on the button (link)?

$('.link').on('click', function(e){
    e.preventDefault();
    $(this).attr('href');
});

Or did I misunderstand?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question