Reputation: 656
I have this ajax call:
$.ajax({
type: 'GET',
url: '/Controller/[email protected]&[email protected]&[email protected]&[email protected]',
dataType: 'html',
cache: false,
success: function (res) {
target.html(res);
setup();
}
});
The problem I think I am having is that @Model.C has spaces in the value.
Is there a setting that will put the %20 in automatically, or another way things are usually done
Upvotes: 1
Views: 48
Reputation: 1
You can use @Model.C.Replace(" ", "%20")
, if spaces are the only extraneous characters you expect to find. You can find a more detailed information from the RFC: https://www.rfc-editor.org/rfc/rfc3986#section-2.1
Upvotes: 0
Reputation: 76817
You can use encodeURI
console.log(encodeURI("a b c"))
and that will encode other characters as well. Just make sure you do not call it on the whole URL.
Upvotes: 1