$.post("/students/fetch", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});
How can return "Any sample text from a action in ruby and rails.". I want to do something li开发者_Python百科ke:--
def fetch
// do something... some processing... and finally
return "any random string "
end
So whole story should be something like:--
- Send a post request.
- return some string from the action.
- alert that string which we got from that action.
to return text from an action:
def fetch
render :text => "any random string"
end
精彩评论