0

This code

function LoadContent(Id) {
        alert('Controls/Network/NetworkDetail.aspx?' + rnd() + '&CtlId=' + Id);
        $.get('Controls/Network/NetworkDetail.aspx?' + rnd() + '&CtlId=' + Id, function(data) {
            $(Id).append(data);
        });
        $(Id).removeClass("Waiting");
}

works perfectly in IE7. the alert displayed intended querystring, and NetworkDetail.aspx page can obtain the CtlId using Request.QueryString["CtlId"]

However, using FF3 and Chrome, Request.QueryString["CtlId"] returns null but the alert displayed the querystring correctly (no difference to IE7).

the Id value is usually '#Tab1', or "#Tab2"

Any idea on how to correctly construct querystring?

1 Answer 1

5

The # indicates a named anchor in HTML and therefore is not part of the querystring, perhaps you sould correctly URL encode your id's.

e.g. #Tab1 becomes %35Tab1

Try using escape. e.g.

'Controls/Network/NetworkDetail.aspx?' + rnd() + '&CtlId=' + escape(Id)

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

2 Comments

You're right. '#' messes my code. But still, browser quirks like this is exactly why I hate javascript development.
IE should not have sent the # part of the URL, as this is intended for the browser not the server, but i do see their point. BTW, using escape also gets over any issues if other URL characters appear in the ID (such as & or ?).

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.