0

I wanted to call a URL when the page fully load. so i came up with this

$(window).load(function() {

        url: "https://shareasale.com/sale.cfm?amount=90.00&tracking=30&transtype=sale&merchantID=xxxxx"
                });

The url was originally like this:

<img src="https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=xxxxx" width="1" height="1">

I don't know how to call the img tag in a javascript/jquery. So I try to use url inside the load() function. I really need help.

0

1 Answer 1

1

Try this: get the url from Image Tag

$(window).load(function() {
 var  url= $('img').attr('src')
       console.log(url)
                });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=xxxxx" width="1" height="1">

Load the url to Image

$(window).load(function() {
  var url="https://shareasale.com/sale.cfm?amount=99.00&tracking=15&transtype=sale&merchantID=xxxxx";
 var  url= $('img').attr('src',url)
       console.log($('img').attr('src'))
                });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img  width="1" height="1">

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.