I have a simple jquery function as
function sendValue(str){
$.post("test.php",{ sendValue: str },
function(data){
$('#display').html(data.returnValue);
}, "json");
}
I want to replace space within the string. I thought I can do this by adding
str.replace(" ", "+");
to the second line of the function. But it did not work. I know very basic of javascript. How to replace " " with "+" in the string before posting data to test.php?
strto the server on the first line currently, so you need to do the replace before that.