0

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.

3
  • Why are you making an ajax call to a static html page? Commented Nov 1, 2012 at 19:08
  • 1
    Just... pass the variable: $.get(content, function....); Commented Nov 1, 2012 at 19:08
  • it's for a menu, html page has a list of /ul/li items. Commented Nov 1, 2012 at 19:09

2 Answers 2

6

Since it's already in a variable, use:

var content= '<%=_content%>';
$.get(content, function (data) {                
    $('#flyout').menu({ content: data, flyOut: true });
});
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.