Javascript Google地图自动完成删除空白并在地址字符串中插入加号(+;)
大家好,我的页面上有谷歌地图地址自动完成搜索框。当我按Enter键时,我的 Url如下所示:Javascript Google地图自动完成删除空白并在地址字符串中插入加号(+;),javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,大家好,我的页面上有谷歌地图地址自动完成搜索框。当我按Enter键时,我的 Url如下所示: 艾尔 与此相反,我希望我的url看起来像这样,我希望在空白处插入加号 脚本: predictionsDropDown.empty(); $.each(predictions, function(i, prediction) { predictionsDropDown.append('<div>' + $.fn.cityAutocomplete.transliterat
艾尔 与此相反,我希望我的url看起来像这样,我希望在空白处插入加号
脚本:
predictionsDropDown.empty();
$.each(predictions, function(i, prediction) {
predictionsDropDown.append('<div>' + $.fn.cityAutocomplete.transliterate(prediction.terms[0].value) + '</div' +'<div> '+ $.fn.cityAutocomplete.transliterate(prediction.terms[1].value) + '</div');
});
predictionsDropDown.empty();
$。每个(预测,函数(i,预测){
predictionsDropDown.append(“”+$.fn.cityAutocomplete.translation(prediction.terms[0].value)+”使用字符串替换函数应该满足您的需要。Javascript或PHP替换函数都应该这样做
Javascript
string.replace(“ “,”+”)
PHP
str_replace(" ","+","string");