我正在尝试使用 jquery/ajax 调用休息服务器休息服务器内置在 Codeigniter ajax 功能如下:
var req = $.ajax({
type: 'GET',
url: "http://localhost/projects/comp6300Server/index.php/resources/token//username/" + email + "/password/" + pword + "/institution/" + inst,
contentType: "application/json; charset=utf-8",
dataType: "json"
})
生成的请求如下:
http://localhost/projects/comp6300Server/index.php/resources/token//username/etambie@yahoo.com/password/qwerty/institution/BCC
返回的状态是“400 Bad Request”我认为问题可能出在“etambie@yahoo.com”中传递的电子邮件。ajax 有没有办法自动将'@'转换为'%40',还是我必须手动转换字符串中的所有特殊字符?