Salamander2007
Salamander2007

Reputation: 6394

Dynamically construct querystring behaviour in IE and FF / Chrome

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?

Upvotes: 0

Views: 611

Answers (1)

Ady
Ady

Reputation: 4736

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)

Upvotes: 5

Related Questions