Steven Jones
Steven Jones

Reputation: 694

How to get URL in jQuery

I am currently using this code:

jQuery("input[type=file]").filestyle({ image: "http://localhost:8888/davidgray/wp-content/themes/davidgray/images/browse.png", imageheight : 22, imagewidth : 72, width : 460 });

However when I switch it over to live I of course want the URL that it's going to be on, how do I make this dynamic?

Cheers, Steve

Upvotes: 1

Views: 326

Answers (2)

Matthew Riches
Matthew Riches

Reputation: 2286

Just use a relative URL

    jQuery("input[type=file]").filestyle({
        image: "/davidgray/wp-content/themes/davidgray/images/browse.png",
        imageheight : 22,
        imagewidth : 72,
        width : 460
    });

Upvotes: 3

Simon
Simon

Reputation: 415

Use window.location ?

here is an article worth reading.

http://davidwalsh.name/javascript-window-location

(This is assuming you do not know the relative url)

Upvotes: 0

Related Questions