Daniel Sh.
Daniel Sh.

Reputation: 2074

jQuery .get('variable url')

Am I drowning in a glass of water or is there something tricky about this?

$.get('content.html', function (data) {                
            $('#flyout').menu({ content: data, flyOut: true });
        });

Thing is content.html will vary amongst users. Sometimes it'll be content.html, some others will be content2.html.

How can I use a variable in the url section of .get? Let's say var content= '<%=_content%>' holds the desired value

I have the value stored in a C# variable, and in an asp:Label.

Tried several things but I can't find the way to do it. I've also tried to alert the whole thing but it's giving me the object, changed .et to .ajax and it didn't work either, I must be missing something.

Thanks in advance.

Upvotes: 0

Views: 367

Answers (2)

Manjunath Manoharan
Manjunath Manoharan

Reputation: 4617

$.get("<%= _content %>", function (data) {                
    $('#flyout').menu({ content: data, flyOut: true });
});

Upvotes: 1

pete
pete

Reputation: 25081

Since it's already in a variable, use:

var content= '<%=_content%>';
$.get(content, function (data) {                
    $('#flyout').menu({ content: data, flyOut: true });
});

Upvotes: 6

Related Questions