views:

265

answers:

1

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?

+5  A: 

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)

Ady
You're right. '#' messes my code. But still, browser quirks like this is exactly why I hate javascript development.
Salamander2007
Ady