Mobile app version of vmapp.org
Login or Join
Lee4591628

: How can I remove plus sign in jquery string How can I remove + sign from string in Jquery $('#sender_name'). val(). If I entered any space then it include a + sign So in my controller I

@Lee4591628

Posted in: #Ajax #Codeigniter #Jquery

How can I remove + sign from string in Jquery $('#sender_name'). val(). If I entered any space then it include a + sign

So in my controller I cant get accurate value due to + sign (I am using Ajax call that goes every time when I enter a single word).

For example if I entered in text field 'Hello World' then it will return 'hello+world' i want to remove + sign.

$(function()
{
$( "#sender_name" ).autocomplete({
'search':function(event,ui){`
var newUrl="<?=base_url()?>login/city/"+$("#sender_name").val();
$(this).autocomplete("option","source",newUrl)
},
source':[]
});
});

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

When a plus sign replaces a space, that is a sign that the text has been url-encoded. You just need to url-decode the text in your controller. You don't state what programming language you use, but all languages have some a function available for doing this.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme