我想分配JavaScript變量通過Ajax請求紅寶石變量,所以我在JavaScript函數寫下面的代碼:如何使用AJAX請求將JavaScript變量分配給ruby變量?
var timezone = jstz.determine();
var encoded = encodeURIComponent('<%= groups_path%>'+'[email protected]=' + <%[email protected]%>+'&time_zone='+timezone.name());
$.ajax({
type: "get",
url: encoded,
dataType: "JSON",
success: function(data)
{
<%[email protected]=params[:time_zone]%>
}
});
但它給GET http://0.0.0.0:3001/%2Fgroups%3F%40myActivity%3D1%26time_zone%3DAsia%2FCalcutta 404 (Not Found)
錯誤。