jeudi 5 mars 2015

How to put a value in my success ajax function parameter from my controller in ruby on rails

I have a following ajax request in my java script and it is calling run_me method in my controller.



$.ajax({
type: 'GET',
url:'/static_pages/run_me',
data: {my_name: envi},
success: function(){
$('#loadingmessage').hide();
$('#show_ip').show();
}
});


Now I want to put a value from my method in the controller ( just a random (local) value not a instance variable) and pass it to the parameter in the success : function.



success: function(var){}


I saw lots of thread in stackoverflow and they were talking about use respond_to method but I didnt really understand them! Can some one explain this to me Thanks


Aucun commentaire:

Enregistrer un commentaire