jquery Ajax を使用してクライアントにデータを送信し、クライアントから応答を取得しています。Play Framework をバックエンドとして使用しています。
AJAX:
$.ajax({
type: "GET",
url: '/authenticate',
data: {'type':type, 'redirectURL':getRedirectURL},
contentType: "application/json; charset=UTF-8",
dataType: 'json'
}).success(function( msg, txtStatus, jqXHR) {
console.log("asdasd5= "+msg);
console.log("asdasd5= "+msg.authUrl);
console.log("asdasd5= "+jqXHR.authUrl);
window.location = msg;
});
サーバーデータの作成:
response.setContentTypeIfNotSet("text/plain; charset=UTF-8");
Logger.info("response content type ="+response.contentType);
renderJSON("{\"authUrl\": " + authUrl +"}");
サーバーは「www.mywebsite.com/yoohoo/auth/1231」のようなものを送信しています
しかし、Ajax が受け取る応答は次のとおりです。�����������������{"authUrl": www.mywebsite.com/yoohoo/auth/1231}
これらの奇妙な文字が原因で、受信した JSON 応答を jQuery で解析できません。親切に、これについて助けてください。
ありがとう