0

コントローラーの方法:

def add
@project = Project.find(1)
render xml: @project  #wish to pass one more variable like this here
end

ajax 呼び出し:

endpoint = ROOT_PATH + '/projects/add/'+data_type;
    $.ajax({
            url : endpoint,
            type : "get",
            dataType : "xml",
            success : function(xml) {

                            id = $(xml).find('id').text();
                title = $(xml).find('title').text();

                   // wish to display the sent additional parameter here.
    }
    });

ajax 呼び出しでプロジェクト インスタンス パラメーター 'id' と 'title' を取得できますが、@project と共にもう 1 つのパラメーターを送信し、ajax 呼び出し内でこのパラメーターの値を使用したいと考えています。誰かが私を助けてくれませんか。ありがとう!

4

1 に答える 1