Я отправил URL как часть параметра запроса с помощью encodeURIcomponent на сервер, например
http://www.regis.edu/regisgpcd.asp?sctn=cpedcn&p1=ap&p2=EDFD&p3=cd3Dcd&_=1332612418587
Вот что видит сервер:
http://www.regis.edu/regisgpcd.asp?sctn=cpedcn&p1=ap&p2=EDFD&p3=cd
хотя я вставил его раньшеснова база данных с encodeURIcomponent, я получил ошибку, что он не может быть найден в базе данных.
Этот URL-адрес в формате, как показано ниже, хотя я снова вставил его после кодирующего компонента.Я предполагаю, что mysql преобразовал его в обычный вид, прежде чем вставить его в столбец.
http://www.regis.edu/regisgpcd.asp?sctn=cpedcn&p1=ap&p2=EDFD&p3=cd
Как я могу решить эту проблему?Любая идея?
Это мой код вставки:
$.ajax({
type : "GET",
url : '/tree/insertResult/?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title)+'&folder='+folderName+'&snippet='+encodeURIComponent(snippet),
cache : false,
success : function(res) {
if(res == "F")
notification("Operation Failed", "You have that bookmark in that folder!");
else{
folderName = res;
notification("Operation Suceeded", "Bookmark has been created.");
updateFolderContent(url, title, folderName, snippet);//it is in _filetree_javascript.html.erb
}
},
error : function(x, y, z) {
alert(x.responseText);
}
});
}
Это мой код извлечения:
$.ajax({
type : "GET",
url : '/tree/deleteResult/?title='+encodeURIComponent(title)+"&url="+encodeURIComponent(url),
cache : false,
success : function(res) {
if(res == "F") //if F is returned from server it means "There is a folder with same name"
notification("Operation Failed", "Bookmark cannot be deleted! Sorry :(");
else
notification("Operation Succeed", "Bookmark've been deleted.");
deleteResult(domObj);
},
error : function(x, y, z) {
alert(x.responseText);
}
});
}