Rails 如何簡單回應 AJAX? 就用 json 啊 
        
      WriterShelf™ is a unique multiple pen name blogging and forum platform. Protect relationships and your privacy. Take your writing in new directions. ** Join WriterShelf**
      
        WriterShelf™ is an open writing platform. The views, information and opinions in this article are those of the author.
      
  
          Article info
        
        
              Categories:
            
            
                    
⟩
⟩
                  
                  
                    
⟩
⟩
                  
                  
                    
⟩
⟩
                  
            
              Tags:
            
            
              Total: 695 words
          
      
              Like
              
              or Dislike
              
            
          About the Author
          很久以前就是個「寫程式的」,其實,什麼程式都不熟⋯⋯
就,這會一點點,那會一點點⋯⋯
        More to explore
      
       
 
 
 
 
 
 
 

在 AJAX 呼叫 Rails 的 Controller 後,我想最重要的就是知道 server 這邊處理的結果,一般我們都會用一個與 controller 同名的 view.js 去自動執行,一般都是 refresh 網頁啊,或是跳到另一個網址等等。
但有沒有更簡單的方法啊,我是這樣用的,直接上 code,少囉唆:
AJAX side:
Server side:
重點說明:
AJAX 很好用,也方便,但是使用時,要盡量不要呼叫一大堆,畢竟,每一次呼叫都要重啟連線,雖然 AJAX 很快了,但是如果能整合成一個,會方便開發,提高性能,更可以少用很多的 call back。