javascript - Filepath and it's URL variable is cut short when concatenated -


i have following jquery ajax function:

function jqueryajaxfunction(){ $input = document.getelementbyid("textinput").value; console.log($input ); //console output: "how to" $('#resultsoutput').load('ajax/serverside/filepath.php?urlvariable='+$input); }  

it retrieves value of $input text field, 2 letter word such "how to" , displays on browser's console.

$input concatenated file path server side script , assigned url variable. however, in doing last word of $input -in case "to"- disappears/is cut off.

once function executed, url variable on server retrieved , displayed using example: $_get["urlvariable"] it's value can guess "how".

what recommended solution problem? how can $_get["urlvariable"] equal "how to".

certain characters need encoded when used in urls...a space 1 of them. javascript provides global function encode necessary characters urls - encodeuricomponent. instead of concatenating $input, concatenate:

encodeuricomponent($input) 

reference:


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -